From 542e3f149f13d8257d540988d7921ac41d703232 Mon Sep 17 00:00:00 2001 From: yctimlin Date: Sat, 12 Jul 2025 07:38:35 +0000 Subject: [PATCH] update dockerfile --- Dockerfile | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index fe83e6e..2a994d4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,12 +1,28 @@ +# Production stage - MCP Backend Only FROM node:18-slim +# Create non-root user for security +RUN addgroup --system --gid 1001 nodejs && \ + adduser --system --uid 1001 --gid 1001 nodejs + WORKDIR /app +# Copy package files COPY package*.json ./ -RUN npm install -COPY . . +# Install only production dependencies +RUN npm ci --only=production && npm cache clean --force -EXPOSE 3000 +# Copy source code (only backend files needed) +COPY src ./src +# Set environment variables +ENV NODE_ENV=production +ENV EXPRESS_SERVER_URL=http://localhost:3000 +ENV ENABLE_CANVAS_SYNC=true + +# Switch to non-root user +USER nodejs + +# Run MCP server only CMD ["npm", "start"] \ No newline at end of file