rsnext/examples/with-docker/Dockerfile.multistage
Richard Lee e3244e96a6
Correct production docker base image tag (#19962)
As seen in https://github.com/mhart/alpine-node, the `base` image tag has been renamed to `slim`.
2020-12-08 15:43:24 +00:00

28 lines
No EOL
598 B
Docker

# Stage 1: Building the code
FROM mhart/alpine-node AS builder
WORKDIR /app
COPY package.json yarn.lock ./
RUN yarn install --frozen-lockfile
COPY . .
RUN yarn build
RUN yarn install --production --frozen-lockfile
# Stage 2: And then copy over node_modules, etc from that stage to the smaller base image
FROM mhart/alpine-node:slim as production
WORKDIR /app
# COPY package.json next.config.js .env* ./
COPY --from=builder /app/public ./public
COPY --from=builder /app/.next ./.next
COPY --from=builder /app/node_modules ./node_modules
EXPOSE 3000
CMD ["node_modules/.bin/next", "start"]