-
Notifications
You must be signed in to change notification settings - Fork 93
/
Dockerfile
54 lines (41 loc) · 1.11 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
FROM ghcr.io/puppeteer/puppeteer:22.8.1 as base
WORKDIR /app
USER root
RUN apt-get update && \
apt-get install -y tini && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
ARG SCOPE
ENV SCOPE=$SCOPE
ARG PACKAGE_CONTAINERS="apps packages"
ARG CLEANING_TARGETS="src test .turbo .eslintrc.* jest.config.* tsup.config.* tsconfig.*"
ARG PORT=3000
ENV PORT=$PORT
RUN corepack enable
RUN npm install -g turbo
FROM base as pruner
COPY pnpm-lock.yaml .
RUN pnpm fetch
ADD . .
RUN turbo prune --scope=$SCOPE --docker
FROM base as installer
COPY --from=pruner /app/out/full .
COPY --from=pruner /app/out/pnpm-lock.yaml .
RUN pnpm install -r
FROM base as builder
COPY --from=installer /app .
COPY --from=pruner /app/out/pnpm-workspace.yaml .
RUN pnpm run build --filter=$SCOPE
FROM base as runner
COPY --from=builder /app .
RUN pnpm install -r --prod --ignore-scripts
RUN for c in $PACKAGE_CONTAINERS; do \
for t in $CLEANING_TARGETS; do \
rm -rf ./$c/*/$t; \
done; \
done;
EXPOSE $PORT
RUN chown -R pptruser:pptruser /app
USER pptruser
ENTRYPOINT ["/usr/bin/tini", "--"]
CMD pnpm --filter=$SCOPE run start