Created
September 17, 2022 12:58
-
-
Save mcorkum/95ce3cd2dfd709667506bdc709ed8a12 to your computer and use it in GitHub Desktop.
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
# Install dependencies | |
FROM node:16 AS dependencies | |
WORKDIR /app | |
COPY package.json yarn.lock ./ | |
RUN yarn install --frozen-lockfile | |
# Run yarn build | |
FROM node:16 AS builder | |
WORKDIR /app | |
COPY --from=dependencies /app/node_modules ./node_modules | |
COPY . . | |
RUN yarn build | |
# Production image, copy all the files and run next | |
FROM node:16 AS runner | |
WORKDIR /app | |
ENV NODE_ENV production | |
COPY --from=builder --chown=node:node /app/. . | |
# default to port 80 for node, and 9229 and 9230 (tests) for debug | |
ARG PORT=80 | |
ENV PORT $PORT | |
EXPOSE $PORT 9229 9230 | |
CMD [ "yarn", "run", "start" ] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment