notea/Dockerfile

29 lines
590 B
Docker
Raw Normal View History

2021-03-28 08:19:18 +03:00
# Stage 1: Building the code
2021-10-29 11:22:51 +03:00
FROM node:lts-alpine AS builder
2021-03-28 08:19:18 +03:00
2021-03-09 16:11:09 +03:00
WORKDIR /app
2021-03-28 08:19:18 +03:00
2021-03-09 16:11:09 +03:00
COPY package.json yarn.lock ./
2021-03-28 08:19:18 +03:00
2021-03-09 16:11:09 +03:00
RUN yarn install --frozen-lockfile
2021-02-22 17:40:13 +03:00
COPY . .
2021-03-28 08:19:18 +03:00
2021-02-22 17:40:13 +03:00
RUN yarn build
2021-03-28 08:19:18 +03:00
RUN yarn install --production --frozen-lockfile
2021-02-22 17:40:13 +03:00
2021-03-09 16:11:09 +03:00
2021-03-28 08:19:18 +03:00
# Stage 2: And then copy over node_modules, etc from that stage to the smaller base image
2021-10-29 11:22:51 +03:00
FROM node:lts-alpine as production
2021-03-28 08:19:18 +03:00
WORKDIR /app
2021-03-09 16:11:09 +03:00
2021-03-28 08:19:18 +03:00
# COPY package.json next.config.js .env* ./
2021-03-09 16:11:09 +03:00
COPY --from=builder /app/public ./public
COPY --from=builder /app/.next ./.next
COPY --from=builder /app/node_modules ./node_modules
EXPOSE 3000
2021-02-22 17:40:13 +03:00
CMD ["node_modules/.bin/next", "start"]