-
Notifications
You must be signed in to change notification settings - Fork 3
/
Dockerfile.web
50 lines (30 loc) · 981 Bytes
/
Dockerfile.web
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
FROM node:18-alpine 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/web --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/web
RUN rm -rf **/node_modules && pnpm i --prod
# ? -------------------------
FROM gcr.io/distroless/nodejs18-debian11:nonroot as runner
WORKDIR /app
USER nonroot
EXPOSE 8080
ENV NODE_ENV production
ENV PORT 8080
COPY --from=installer /app/node_modules ./node_modules
COPY --from=installer /app/apps/web/dist ./apps/web/dist
COPY --from=installer /app/apps/web/server.mjs ./apps/web/server.mjs
COPY --from=installer /app/apps/web/node_modules ./apps/web/node_modules
CMD ["./apps/web/server.mjs"]