-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathDockerfile
More file actions
66 lines (45 loc) · 1.54 KB
/
Dockerfile
File metadata and controls
66 lines (45 loc) · 1.54 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
# ================ #
# Base Stage #
# ================ #
FROM node:18-buster-slim as base
WORKDIR /usr/src/app
ENV HUSKY=0
ENV CI=true
RUN apt-get update && \
apt-get upgrade -y --no-install-recommends && \
apt-get install -y --no-install-recommends openssl build-essential python3 libfontconfig1 dumb-init && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
COPY --chown=node:node yarn.lock .
COPY --chown=node:node package.json .
COPY --chown=node:node .yarnrc.yml .
COPY --chown=node:node .yarn/ .yarn/
RUN sed -i 's/"postinstall": "husky install .github\/husky"/"postinstall": ""/' ./package.json
ENTRYPOINT ["dumb-init", "--"]
# ================ #
# Builder Stage #
# ================ #
FROM base as builder
ENV NODE_ENV="development"
COPY --chown=node:node tsconfig.base.json tsconfig.base.json
COPY --chown=node:node tsup.config.ts .
COPY --chown=node:node src/ src/
COPY --chown=node:node prisma/ prisma/
RUN yarn install --immutable
RUN yarn run prisma
RUN yarn run build
# ================ #
# Runner Stage #
# ================ #
FROM base AS runner
ENV NODE_ENV="production"
ENV NODE_OPTIONS="--enable-source-maps"
WORKDIR /usr/src/app
COPY --chown=node:node src/.env src/.env
COPY --chown=node:node --from=builder /usr/src/app/dist dist
COPY --chown=node:node --from=builder /usr/src/app/src/languages src/languages
RUN yarn workspaces focus --all --production
# Patch .prisma with the built files
COPY --chown=node:node --from=builder /usr/src/app/node_modules/.prisma node_modules/.prisma
USER node
CMD [ "yarn", "run", "start" ]