Dockerfile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM node:14.15.3-alpine AS builder | |
WORKDIR /app | |
ENV NPM_CONFIG_LOGLEVEL warn | |
ENV NPM_CONFIG_FUND false | |
ENV NPM_CONFIG_AUDIT false | |
ENV CI true | |
COPY package.json package-lock.json ./ | |
RUN npm ci | |
COPY . . | |
RUN npm run build | |
RUN npm prune --production | |
FROM node:14.15.3-alpine | |
ENV NPM_CONFIG_LOGLEVEL warn | |
ENV NODE_ENV production | |
ENV PORT 3000 | |
WORKDIR /app | |
COPY --from=builder /app/node_modules ./node_modules | |
COPY --from=builder /app/.next ./.next | |
COPY public public | |
EXPOSE 3000 | |
USER node | |
CMD ["npx", "pm2-runtime", "./node_modules/.bin/next", "--", "start"] |