forked from ViewTube/viewtube
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
53 lines (35 loc) · 1.56 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
FROM node:20-bookworm AS build
WORKDIR /home/build
COPY package.json pnpm-lock.yaml pnpm-workspace.yaml ./
COPY server/package.json ./server/
COPY shared/package.json ./shared/
COPY client/package.json ./client/
COPY client/scripts ./client/scripts
COPY patches ./patches
RUN npm install -g [email protected]
RUN pnpm install --frozen-lockfile
COPY . .
RUN pnpm run build
RUN rm -rf node_modules client/node_modules server/node_modules shared/node_modules "$(pnpm store path)"
RUN CI=true pnpm --filter=./server --filter=./client install --frozen-lockfile --prod
FROM node:20-bookworm-slim AS runtime
WORKDIR /home/app
ENV NODE_ENV=production
COPY --from=build /home/build/package.json ./
COPY --from=build /home/build/client/package.json ./client/
COPY --from=build /home/build/server/package.json ./server/
COPY --from=build /home/build/shared/package.json ./shared/
COPY --from=build /home/build/node_modules ./node_modules
COPY --from=build /home/build/server/node_modules ./server/node_modules
COPY --from=build /home/build/server/dist ./server/dist/
COPY --from=build /home/build/shared/dist ./shared/dist/
COPY --from=build /home/build/client/.output ./client/.output/
RUN \
--mount=type=cache,target=/var/cache/apt \
apt-get update \
&& apt-get install -y --no-install-recommends curl ca-certificates \
&& rm -rf /var/cache/apt/archives /var/lib/apt/lists/*
ENV VIEWTUBE_BASE_DIR=/home/app
HEALTHCHECK --interval=30s --timeout=20s --start-period=60s --retries=5 CMD curl --fail http://localhost:8066/ || exit 1
EXPOSE 8066
CMD ["node", "/home/app/server/dist/main.js"]