diff --git a/docker/Dockerfile b/docker/Dockerfile index 36fe569..a1d540a 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -16,18 +16,21 @@ RUN npm run build # Production Stage FROM node:lts-alpine -ENV NODE_ENV production -USER node +ENV NODE_ENV=production # Create app directory WORKDIR /app +# Install only production dependencies as root first +COPY package*.json ./ +RUN npm install --production && npm cache clean --force + # Copy built app from build stage COPY --from=build-stage /app/dist ./dist -# Install only production dependencies -COPY package*.json ./ -RUN npm install --production +# Change ownership to node user and switch to node user +RUN chown -R node:node /app +USER node # Define the entrypoint and default command # If you have a custom entrypoint script