-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
39 lines (28 loc) · 1.05 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
FROM rustlang/rust:nightly-bullseye-slim as builder
LABEL org.opencontainers.image.source="https://github.com/campbellcole/acad"
WORKDIR /usr/src/acad
# create skeleton project
RUN cargo init
# copy over dependencies
COPY Cargo.toml Cargo.toml
COPY Cargo.lock Cargo.lock
# build dependencies
RUN --mount=type=cache,target=/usr/local/cargo/registry \
cargo build --release --locked
# copy over project
COPY src ./src
# build project
RUN --mount=type=cache,target=/usr/local/cargo/registry \
touch src/main.rs && \
cargo build --release --locked
FROM ubuntu:latest
# install ca-certificates & python (required for yt-dlp)
RUN apt update && \
apt install --no-install-recommends -y ca-certificates wget python3 ffmpeg && \
rm -rf /var/lib/apt/lists/*
# install yt-dlp
RUN wget 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
COPY --from=builder /usr/src/acad/target/release/acad /acad
# and run it (environment vars must be set in docker-compose.yml)
CMD ["/acad"]