dzmedia/Dockerfile

22 lines
619 B
Docker
Raw Permalink Normal View History

2022-08-16 15:59:09 +00:00
FROM rust:latest as builder
WORKDIR /usr/src/app
COPY . .
# Will build and cache the binary and dependent crates in release mode
RUN --mount=type=cache,target=/usr/local/cargo,from=rust:latest,source=/usr/local/cargo \
--mount=type=cache,target=target \
cargo build --release && mv ./target/release/dzmedia ./dzmedia
2022-08-16 15:59:09 +00:00
# Runtime image
2024-01-07 12:25:13 +00:00
FROM debian:bookworm-slim
2022-08-16 15:59:09 +00:00
# Run as "app" user
RUN useradd -ms /bin/bash app
USER app
WORKDIR /app
# Get compiled binaries from builder's cargo install directory
COPY --from=builder /usr/src/app/dzmedia /app/dzmedia
2022-08-16 15:59:09 +00:00
# No CMD or ENTRYPOINT, see fly.toml with `cmd` override.