notea/Dockerfile

34 lines
666 B
Docker
Raw Normal View History

2021-03-28 08:19:18 +03:00
# Stage 1: Building the code
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
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
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"]