Dockerfile: fixed installation of prod dependencies
This commit is contained in:
@@ -13,14 +13,18 @@ RUN npm i && npm cache clean --force
|
|||||||
# building app
|
# building app
|
||||||
RUN npm run build
|
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
|
# Stage 2: Run the Next.js server
|
||||||
FROM gcr.io/distroless/nodejs:18 as prod-image
|
FROM gcr.io/distroless/nodejs:18 as prod-image
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
COPY --from=builder /app/package.json /app/package-lock.json ./
|
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 --from=builder /app/.next ./.next
|
||||||
COPY ./public /app/public
|
COPY ./public /app/public
|
||||||
|
|||||||
Reference in New Issue
Block a user