Repository navigation
Expand file tree
/
Copy pathDockerfile
More file actions
46 lines (37 loc) · 1.34 KB
/
Copy pathDockerfile
File metadata and controls
46 lines (37 loc) · 1.34 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
# syntax=docker/dockerfile:1.7-labs
FROM rust:1.98-slim AS chef
WORKDIR /usr/src/
RUN apt-get update && apt-get install -y --no-install-recommends \
pkg-config \
libssl-dev \
&& rm -rf /var/lib/apt/lists/*
RUN cargo install cargo-chef --locked
FROM chef AS planner
COPY Cargo.toml Cargo.lock ./
COPY migration/Cargo.toml migration/Cargo.toml
RUN cargo chef prepare --recipe-path recipe.json
FROM chef AS builder
COPY --from=planner /usr/src/recipe.json recipe.json
RUN cargo chef cook --release --recipe-path recipe.json
COPY . .
RUN cargo build --release --bins
FROM denoland/deno:bin AS deno
FROM debian:trixie-slim
# yt-dlp runs ffmpeg and ffprobe from PATH. It needs Deno (copied below) to
# decipher YouTube signatures.
RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates \
tini \
curl \
ffmpeg \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /usr/app
COPY --from=builder /usr/src/assets /usr/app/assets
COPY --from=builder /usr/src/config /usr/app/config
COPY --from=builder /usr/src/target/release/localtube-cli /usr/app/localtube-cli
COPY --from=deno /deno /usr/local/bin/deno
# Sanity check
RUN deno --version \
&& deno eval 'if (1 + 1 !== 2) throw new Error("deno sanity check failed"); console.log("deno ok");' \
&& /usr/app/localtube-cli --version
ENTRYPOINT ["tini", "--", "/usr/app/localtube-cli"]