Quantcast
Channel: Recent Gists from badsyntax
Viewing all articles
Browse latest Browse all 31

Next.js Dockerfile

$
0
0
Dockerfile
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"]

Viewing all articles
Browse latest Browse all 31

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>