-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
44 lines (34 loc) · 993 Bytes
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# BASE
FROM node:16.13.1-slim AS base
WORKDIR /app
COPY package.json yarn.lock ./
RUN yarn install --frozen-lockfile --no-progress
COPY . .
# BUILD
FROM base AS build
ENV NODE_ENV=production
ENV NEXT_TELEMETRY_DISABLED=1
ARG _SENTRY_AUTH_TOKEN
ENV SENTRY_AUTH_TOKEN=$_SENTRY_AUTH_TOKEN
WORKDIR /build
COPY --from=base /app ./
RUN apt-get update -y
RUN apt-get install ca-certificates -y
RUN yarn build
# Package install
FROM node:16.13.1-slim AS node_modules
ENV NODE_ENV=production
WORKDIR /modules
COPY package.json yarn.lock ./
RUN yarn install --non-interactive --frozen-lockfile --production --no-progress
# Production Run
FROM gcr.io/distroless/nodejs:16
ENV NODE_ENV=production
ENV NEXT_TELEMETRY_DISABLED=1
WORKDIR /app
COPY package.json yarn.lock next.config.js ./
COPY --from=build /build/public ./public
COPY --from=build /build/.next ./.next
COPY --from=node_modules /modules/node_modules ./node_modules
EXPOSE 8080
CMD ["node_modules/.bin/next", "start", "-p", "$PORT"]