Files
evidencija-rezija/Dockerfile

29 lines
578 B
Docker

# Stage 1: Build the Next.js project
FROM node:18 AS builder
ENV WORKDIR=/app
WORKDIR /app
# copy all the soruce code
COPY . .
# installing dependencies
RUN npm i && npm cache clean --force
# building app
RUN npm run build
# 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
CMD ["npm", "start"]