-
Notifications
You must be signed in to change notification settings - Fork 88
Expand file tree
/
Copy pathDockerfile
More file actions
67 lines (51 loc) · 1.9 KB
/
Dockerfile
File metadata and controls
67 lines (51 loc) · 1.9 KB
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# ---------------------------------------------------------
# Base build dependencies (development + production)
# ---------------------------------------------------------
FROM node:22.5.1-alpine AS builder-base
WORKDIR /app
RUN apk --no-cache --quiet add \
bash \
build-base \
dumb-init \
git
# Copy files required to install application dependencies
COPY package.json yarn.lock .yarnrc.yml ./
COPY .yarn ./.yarn
COPY patches ./patches
# Install packages
RUN yarn install --immutable && \
yarn cache clean
# Copy application code
COPY . ./
RUN yarn build
# ---------------------------------------------------------
# Builder with production-only dependencies
# ---------------------------------------------------------
FROM builder-base AS builder-production
# Create production-only node_modules
RUN rm -rf node_modules && \
yarn workspaces focus --all --production
# ---------------------------------------------------------
# Release image
# ---------------------------------------------------------
#
# Release stage. This stage creates the final docker image that will be
# released. It contains only production dependencies and artifacts.
#
FROM node:22.5-alpine AS production
WORKDIR /app
RUN apk --no-cache --quiet add \
bash \
dumb-init \
git \
&& adduser -D -g '' deploy
RUN chown deploy:deploy $(pwd)
# Switch to deploy user
USER deploy
COPY --chown=deploy:deploy --from=builder-production /app/.circleci ./.circleci
COPY --chown=deploy:deploy --from=builder-production /app/build ./build
COPY --chown=deploy:deploy --from=builder-production /app/src/data ./src/data
COPY --chown=deploy:deploy --from=builder-production /app/node_modules ./node_modules
COPY --chown=deploy:deploy --from=builder-production /app/scripts/load_secrets_and_run.sh load_secrets_and_run.sh
ENTRYPOINT ["/usr/bin/dumb-init", "./load_secrets_and_run.sh"]
CMD ["node", "--heapsnapshot-signal=SIGUSR2", "build/index.js"]