-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
44 lines (28 loc) · 1.14 KB
/
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
FROM node:18.18 as base
WORKDIR /var/app
# The SENTRY_AUTH_TOKEN is used to upload the source maps to Sentry
ARG SENTRY_AUTH_TOKEN
ENV SENTRY_AUTH_TOKEN ${SENTRY_AUTH_TOKEN}
COPY package.json yarn.lock ./
RUN yarn install --non-interactive --frozen-lockfile --ignore-optional
COPY . .
RUN yarn build
### REMOVE DEV DEPENDENCIES ##
FROM base as dependencies
RUN yarn install --non-interactive --frozen-lockfile --ignore-optional --production
### BUILD MINIFIED PRODUCTION ##
FROM node:18.18 as production
# Add Tini
ENV TINI_VERSION v0.18.0
ENV NEXT_SHARP_PATH=/app/node_modules/sharp
ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini-static /tini
RUN chmod +x /tini
ENTRYPOINT ["/tini", "--"]
WORKDIR /var/app
COPY --from=dependencies /var/app/package.json /var/app/package.json
COPY --from=dependencies /var/app/healthCheck.js /var/app/healthCheck.js
COPY --from=dependencies /var/app/public /var/app/public
COPY --from=dependencies /var/app/.next /var/app/.next
COPY --from=dependencies /var/app/node_modules /var/app/node_modules
HEALTHCHECK --interval=15s --timeout=5s CMD node /var/app/healthCheck.js
CMD [ "yarn", "start" ]