Created
February 20, 2023 20:46
-
-
Save nataliaconde/73a981a99de1af6eb1f586107fa4621d 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
# Dockerfile | |
FROM node:18-alpine AS dependencies | |
RUN apk add --no-cache libc6-compat | |
WORKDIR /home/app | |
# install dependencies | |
COPY package.json ./ | |
COPY package-lock.json ./ | |
RUN npm i | |
FROM node:18-alpine AS builder | |
WORKDIR /home/app | |
COPY --from=dependencies /home/app/node_modules ./node_modules | |
COPY . . | |
ENV NODE_ENV="production" | |
# build the app | |
RUN npm run build | |
FROM node:18-alpine AS runner | |
WORKDIR /home/app | |
COPY --from=builder /home/app/.next/standalone ./standalone | |
COPY --from=builder /home/app/public /home/app/standalone/public | |
COPY --from=builder /home/app/.next/static /home/app/standalone/.next/static | |
EXPOSE 3000 | |
ENV PORT 3000 | |
# serve the app | |
CMD ["node", "./standalone/server.js"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment