-
Notifications
You must be signed in to change notification settings - Fork 4
/
Dockerfile
60 lines (42 loc) · 1.17 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
49
50
51
52
53
54
55
56
57
58
59
60
FROM node:20-alpine AS custom-node
RUN apk add -f --update --no-cache --virtual .gyp nano bash libc6-compat python3 make g++ caddy \
&& yarn global add turbo pm2 \
&& apk del .gyp
FROM custom-node AS pruned
WORKDIR /app
ARG APP
COPY . .
RUN turbo prune --scope=$APP --docker
FROM custom-node AS installer
WORKDIR /app
ARG APP
COPY --from=pruned /app/out/json/ .
COPY --from=pruned /app/out/yarn.lock /app/yarn.lock
RUN \
--mount=type=cache,target=/usr/local/share/.cache/yarn/v6,sharing=private \
yarn
FROM custom-node as builder
WORKDIR /app
ARG APP
ARG API_URL
ARG COMMIT
ENV COMMIT=${COMMIT}
ENV API_URL=${API_URL}
COPY --from=installer --link /app .
COPY --from=pruned /app/out/full/ .
COPY turbo.json turbo.json
COPY tsconfig.json tsconfig.json
RUN turbo run build --no-cache --filter=${APP}
RUN \
--mount=type=cache,target=/usr/local/share/.cache/yarn/v6,sharing=private \
yarn --frozen-lockfile
#############################################
FROM node:20-alpine AS runner
WORKDIR /app
ARG APP=admin
ARG START_COMMAND=dev
ENV APP=${APP}
ENV START_COMMAND=${START_COMMAND}
ENV PORT=3000
COPY --from=builder /app .
CMD yarn workspace ${APP} ${START_COMMAND}