Repository navigation
Expand file tree
/
Copy pathDockerfile
More file actions
78 lines (60 loc) 路 1.97 KB
/
Copy pathDockerfile
File metadata and controls
78 lines (60 loc) 路 1.97 KB
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
FROM node:22-bookworm-slim AS base
ARG YT_DLP_VERSION=
ENV MUSE_BUNDLED_YT_DLP_PATH=/opt/yt-dlp/bin/yt-dlp
# openssl will be a required package if base is updated to 18.16+ due to node:*-slim base distro change
# https://github.com/prisma/prisma/issues/19729#issuecomment-1591270599
# Install ffmpeg and yt-dlp runtime dependencies
RUN apt-get update \
&& apt-get install --no-install-recommends -y \
ffmpeg \
tini \
openssl \
ca-certificates \
python3 \
python3-venv \
&& python3 -m venv /opt/yt-dlp \
&& if [ -n "${YT_DLP_VERSION}" ]; then \
/opt/yt-dlp/bin/pip install --no-cache-dir "yt-dlp[default]==${YT_DLP_VERSION}"; \
else \
/opt/yt-dlp/bin/pip install --no-cache-dir "yt-dlp[default]"; \
fi \
&& ln -s /opt/yt-dlp/bin/yt-dlp /usr/local/bin/yt-dlp \
&& apt-get autoclean \
&& apt-get autoremove \
&& rm -rf /var/lib/apt/lists/*
# Install dependencies
FROM base AS dependencies
WORKDIR /usr/app
# Add Python and build tools to compile native modules
RUN apt-get update \
&& apt-get install --no-install-recommends -y \
python-is-python3 \
build-essential \
&& apt-get autoclean \
&& apt-get autoremove \
&& rm -rf /var/lib/apt/lists/*
COPY package.json .
COPY yarn.lock .
RUN yarn install --prod
RUN cp -R node_modules /usr/app/prod_node_modules
RUN yarn install
FROM dependencies AS builder
COPY . .
# Run tsc build
RUN yarn prisma generate
RUN yarn build
# Only keep what's necessary to run
FROM base AS runner
WORKDIR /usr/app
COPY --from=builder /usr/app/dist ./dist
COPY --from=dependencies /usr/app/prod_node_modules node_modules
COPY --from=builder /usr/app/node_modules/.prisma/client ./node_modules/.prisma/client
COPY . .
ARG COMMIT_HASH=unknown
ARG BUILD_DATE=unknown
ENV DATA_DIR=/data
ENV NODE_ENV=production
ENV COMMIT_HASH=$COMMIT_HASH
ENV BUILD_DATE=$BUILD_DATE
ENV ENV_FILE=/config
CMD ["tini", "--", "node", "--enable-source-maps", "dist/scripts/migrate-and-start.js"]