Skip to content

Open-source and local-first Slack and Notion alternative that puts you in control of your data

Refactor Dockerfile for improved build and production stages

Image Updaterf860e74fbecc
diff --git a/server/Dockerfile b/server/Dockerfile
index a15f0f35..5a274c01 100644
--- a/server/Dockerfile
+++ b/server/Dockerfile
@@ -1,21 +1,27 @@
# Build stage
FROM node:20-alpine as builder
-
WORKDIR /app
+# Copy package files
COPY package*.json ./
COPY tsconfig.json ./
# Install dependencies
RUN npm ci
+# Copy source files
COPY src/ ./src/
-RUN npm run build
+# Build and verify output
+RUN npm run build && \
+ ls -la dist/ && \
+ if [ ! -f dist/index.js ]; then \
+ echo "dist/index.js not found after build!" && \
+ exit 1; \
+ fi
# Production stage
FROM node:20-alpine
-
WORKDIR /app
# Copy package files
@@ -27,8 +33,14 @@ RUN npm ci --only=production
# Copy built JavaScript files from builder stage
COPY --from=builder /app/dist ./dist
-ENV NODE_ENV=production
+# Verify files were copied correctly
+RUN ls -la dist/ && \
+ if [ ! -f dist/index.js ]; then \
+ echo "dist/index.js not found in production stage!" && \
+ exit 1; \
+ fi
+ENV NODE_ENV=production
EXPOSE 3000
CMD ["node", "dist/index.js"]
\ No newline at end of file