Containerfile
⎇
Raw
1FROM golang:1.26-alpine AS builder
2
3WORKDIR /build
4COPY go.mod go.sum ./
5RUN go mod download
6
7COPY . .
8RUN CGO_ENABLED=0 go build -o vidarchive ./cmd/vidarchive
9
10FROM alpine:3.24
11
12RUN apk --no-cache add ca-certificates ffmpeg python3 py3-pip \
13 && python3 -m venv /opt/ytdlp \
14 && /opt/ytdlp/bin/pip install --no-cache-dir --upgrade yt-dlp
15
16ENV PATH="/opt/ytdlp/bin:${PATH}"
17
18WORKDIR /app
19
20COPY --from=builder /build/vidarchive /app/vidarchive
21COPY --from=builder /build/web /app/web
22
23ENV VIDARCHIVE_DATA_DIR=/data
24ENV VIDARCHIVE_PORT=8080
25
26VOLUME ["/data"]
27
28EXPOSE 8080
29
30# /healthz reports 503 when the database is unreachable. start-period covers
31# migrations on first boot so they don't count as failures.
32HEALTHCHECK --interval=30s --timeout=5s --start-period=15s --retries=3 \
33 CMD wget -q -O /dev/null "http://127.0.0.1:${VIDARCHIVE_PORT}/healthz" || exit 1
34
35# exec form, so the app is PID 1 and gets SIGTERM directly — it needs that for a
36# graceful shutdown (drain requests, kill yt-dlp children, checkpoint the DB).
37ENTRYPOINT ["/app/vidarchive"]
38