-
Notifications
You must be signed in to change notification settings - Fork 0
/
backend.Dockerfile
49 lines (32 loc) · 1.02 KB
/
backend.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
49
FROM node:20-alpine AS builder
WORKDIR /work/backend
COPY backend/package.json backend/yarn.lock ./
RUN yarn
COPY backend .
COPY common /work/common/
RUN yarn compile
FROM node:20-alpine AS runner-base
WORKDIR /work
COPY backend/package.json backend/yarn.lock ./
RUN yarn --production
FROM node:20-alpine AS api-runner
WORKDIR /work
RUN apk add --no-cache tini
COPY --from=runner-base /work/node_modules node_modules/
COPY --from=builder /work/backend/out /work
COPY package.json /work
COPY backend/package.json /work/backend
# NOTE: "node pid 1 problem"
ENTRYPOINT ["/sbin/tini", "--"]
CMD ["node", "backend/src/cmd/index.js"]
FROM node:20-alpine AS job-runner
WORKDIR /work
RUN apk add --no-cache tini git
COPY --from=runner-base /work/node_modules node_modules/
COPY --from=builder /work/backend/out /work
COPY package.json /work
COPY backend/package.json /work/backend
RUN sh -c 'chmod +x ./backend/src/cmd/*.js'
# NOTE: "node pid 1 problem"
ENTRYPOINT ["/sbin/tini", "--"]
CMD ["node", "backend/src/cmd/jobRunner.js"]