-
Notifications
You must be signed in to change notification settings - Fork 3
/
Dockerfile.cms
49 lines (30 loc) · 1014 Bytes
/
Dockerfile.cms
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:18-slim as base
WORKDIR /app
ENV PNPM_HOME=/usr/local/bin
RUN npm i -g pnpm
RUN pnpm add -g turbo
# ? -------------------------
FROM base AS builder
COPY . .
RUN turbo prune --scope=@hackth/cms --docker
# ? -------------------------
FROM base AS installer
WORKDIR /app
COPY --from=builder /app/out/json/ .
COPY --from=builder /app/out/pnpm-lock.yaml ./pnpm-lock.yaml
RUN pnpm i
COPY --from=builder /app/out/full/ .
RUN turbo run build --filter=@hackth/cms
RUN rm -rf **/node_modules && pnpm i --prod
# ? -------------------------
FROM gcr.io/distroless/nodejs18-debian11:nonroot as runner
WORKDIR /app
USER nonroot
ENV NODE_ENV production
ENV PAYLOAD_CONFIG_PATH apps/cms/dist/payload.config.js
EXPOSE 3000
COPY --from=installer /app/node_modules ./node_modules
COPY --from=installer /app/apps/cms/dist ./apps/cms/dist
COPY --from=installer /app/apps/cms/build ./apps/cms/build
COPY --from=installer /app/apps/cms/node_modules ./apps/cms/node_modules
CMD ["./apps/cms/dist/server.js"]