-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
92 lines (71 loc) · 2.43 KB
/
Dockerfile
File metadata and controls
92 lines (71 loc) · 2.43 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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# --- Build Stage ---
FROM node:24.12.0-slim AS builder
WORKDIR /app
ENV CI=true
RUN apt-get update && \
apt-get install -y ffmpeg curl unzip && \
ln -s $(which ffmpeg) /usr/local/bin/ffmpeg && \
npm install -g pnpm && \
mkdir -p /usr/local/bin && \
# yt-dlp
curl -L https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp -o /usr/local/bin/yt-dlp && \
chmod a+rx /usr/local/bin/yt-dlp && \
# Deno
curl -fsSL https://deno.land/x/install/install.sh | sh && \
ln -s /root/.deno/bin/deno /usr/local/bin/deno
# pnpm installieren
RUN npm install -g pnpm
# Workspaces und Dependencies kopieren
COPY pnpm-workspace.yaml ./
COPY package*.json pnpm-lock.yaml ./
# Drizzle Config kopieren
COPY drizzle.config.ts ./
# Restlichen Code kopieren und Build ausführen
COPY . .
# Dependencies installieren
RUN pnpm install --frozen-lockfile --prod=false --node-linker=hoisted
ENV DATABASE_PATH=/data/downloads.db
# Ordner für SQLite erstellen
RUN mkdir -p /data
# Drizzle Migrations kopieren
COPY drizzle drizzle
RUN npx drizzle-kit migrate --config drizzle.config.ts
RUN pnpm build
RUN pnpm prune --production
# --- Production Stage ---
FROM node:24.12.0-slim
WORKDIR /app
RUN apt-get update && \
apt-get install -y ffmpeg curl unzip && \
ln -s $(which ffmpeg) /usr/local/bin/ffmpeg && \
ln -s $(which ffprobe) /usr/local/bin/ffprobe && \
npm install -g pnpm && \
mkdir -p /usr/local/bin && \
# yt-dlp
curl -L https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp -o /usr/local/bin/yt-dlp && \
chmod a+rx /usr/local/bin/yt-dlp && \
# Deno
curl -fsSL https://deno.land/x/install/install.sh | sh && \
ln -s /root/.deno/bin/deno /usr/local/bin/deno
# Build und node_modules kopieren
COPY --from=builder /app/build build/
COPY --from=builder /app/node_modules node_modules/
COPY package.json ./
COPY --from=builder /app/drizzle.config.ts ./
# Drizzle Migrations kopieren
COPY --from=builder /app/drizzle drizzle
# Ordner für SQLite erstellen
RUN mkdir -p /data
# ALTES SQLITE DATA ENTFERNEN UND LEEREN
RUN rm -rf data/*
# Environment-Variablen setzen
ENV NODE_ENV=production
ENV PUBLIC_DEFAULT_CONCURRENCY=1
ENV PUBLIC_MAX_CONCURRENCY=5
ENV DOWNLOAD_PATH=/downloads
ENV DATABASE_PATH=/data/downloads.db
ENV PATH="$PATH:/root/.deno/bin"
# Port freigeben
EXPOSE 3000
# Migration + App starten
CMD ["sh", "-c", "npx drizzle-kit migrate --config drizzle.config.ts && node build"]