-
Notifications
You must be signed in to change notification settings - Fork 93
/
Dockerfile
48 lines (42 loc) · 1.32 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
45
46
47
48
# Build target dependencies #
###########################
FROM node:16.14.2-alpine3.15 AS base
WORKDIR /app
ARG NODE_ENV=production
ENV PATH=/app/node_modules/.bin:$PATH \
NODE_ENV="$NODE_ENV"
COPY package.json yarn.lock /app/
EXPOSE 3040
# Build target dependencies #
###########################
FROM base AS dependencies
# Install prod dependencies
RUN yarn install --production && \
# Cache prod dependencies
cp -R node_modules /prod_node_modules && \
# Install dev dependencies
yarn install --production=false
RUN apk --no-cache add curl g++ make python3
# Build target development #
############################
FROM dependencies AS development
COPY . /app
CMD [ "yarn", "dev" ]
# Build target builder #
########################
FROM base AS builder
ARG SENTRY_AUTH_TOKEN
ENV SENTRY_AUTH_TOKEN="$SENTRY_AUTH_TOKEN"
COPY --from=dependencies /app/node_modules /app/node_modules
COPY . /app
RUN yarn build && \
rm -rf node_modules
# Build target production #
###########################
FROM base AS production
COPY --from=builder /app/.next /app/.next
COPY --from=builder /app/public /app/public
COPY --from=dependencies /prod_node_modules /app/node_modules
COPY next.config.js next-i18next.config.js /app/
CMD [ "yarn", "start" ]
HEALTHCHECK --interval=5s --timeout=3s --retries=3 CMD curl --fail http://localhost:3040 || exit 1