-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
36 lines (28 loc) · 1.07 KB
/
Copy pathDockerfile
File metadata and controls
36 lines (28 loc) · 1.07 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
FROM rust:latest AS chef
RUN rustup default nightly
RUN cargo install cargo-chef
WORKDIR /music-srv
FROM chef AS planner
COPY ./src ./src
COPY ./Cargo.lock ./Cargo.lock
COPY ./Cargo.toml ./Cargo.toml
RUN cargo chef prepare --recipe-path recipe.json
FROM chef AS builder
COPY --from=planner /music-srv/recipe.json recipe.json
# Build dependencies - this is the caching Docker layer!
RUN cargo chef cook --release --recipe-path recipe.json
# Build application
COPY ./src ./src
COPY ./Cargo.toml ./Cargo.toml
COPY ./Cargo.lock ./Cargo.lock
RUN cargo build --release --bin music-srv
RUN objcopy --compress-debug-sections ./target/release/music-srv ./target/release/music-srv-small
FROM debian:stable-slim AS runtime
RUN apt-get update && apt-get install -y yt-dlp mp3gain ffmpeg
WORKDIR /music-srv
COPY --from=builder /music-srv/target/release/music-srv-small ./music-srv
COPY ./templates ./templates
ARG BUILD_TIMESTAMP=dev
LABEL org.opencontainers.image.source="https://github.com/chrisheib/rs_music_server"
RUN printf '%s\n' "$BUILD_TIMESTAMP" > ./build-timestamp.txt
CMD ["./music-srv"]