-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile
43 lines (32 loc) · 891 Bytes
/
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
40
41
42
43
# 1) Build stage
FROM rust:1.71 as builder
WORKDIR /src
# Create empty source
RUN mkdir -p src && echo "fn main(){}" > src/main.rs
# copy over dependency info
COPY ./Cargo.lock ./Cargo.lock
COPY ./Cargo.toml ./Cargo.toml
# Build to cache dependencies
RUN cargo build --release
RUN rm src/*.rs
# copy your source tree
COPY ./src ./src
COPY ./templates ./templates
COPY ./static ./static
# build for release
RUN rm ./target/release/deps/vidl*
RUN cargo build --release
# 2) Runtime stage
# FROM debian:buster-slim
FROM python:3.10-slim-bullseye
RUN apt update && apt install -y ffmpeg
# Install runtime deps
RUN pip3 install --no-cache-dir yt-dlp
# Default config
ENV VIDL_CONFIG_DIR=/config
ENV VIDL_DOWNLOAD_DIR=/downloads
# Copy binary from build
COPY --from=builder /src/target/release/vidl /usr/local/bin
# Run
VOLUME ["/downloads", "/config"]
ENTRYPOINT ["vidl", "web", "-v"]