2021-03-28 08:19:18 +03:00
|
|
|
# Stage 1: Building the code
|
2022-08-12 14:29:47 +03:00
|
|
|
FROM node:16-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
|
2022-08-12 14:29:47 +03:00
|
|
|
FROM node:16-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
|
|
|
|
|
2022-08-12 14:29:47 +03:00
|
|
|
VOLUME /app/config
|
|
|
|
# VOLUME /app/data
|
|
|
|
|
|
|
|
ENV CONFIG_FILE=/app/config/notea.yml
|
|
|
|
|
2021-03-09 16:11:09 +03:00
|
|
|
EXPOSE 3000
|
|
|
|
|
2021-02-22 17:40:13 +03:00
|
|
|
CMD ["node_modules/.bin/next", "start"]
|