Dockerfile: fixed installation of prod dependencies

This commit is contained in:
2024-01-09 16:58:09 +01:00
parent 3abba9347b
commit bf99801157

View File

@@ -13,14 +13,18 @@ RUN npm i && npm cache clean --force
# building app
RUN npm run build
# remove dev dependencies
RUN rm -rf node_modules
# installing production dependencies
RUN npm i --verbose --only=production && npm cache clean --force
# Stage 2: Run the Next.js server
FROM gcr.io/distroless/nodejs:18 as prod-image
WORKDIR /app
COPY --from=builder /app/package.json /app/package-lock.json ./
# installing production dependencies
RUN npm i --verbose --only=production && npm cache clean --force
COPY --from=builder /app/.next ./.next
COPY ./public /app/public