23 lines
632 B
Text
23 lines
632 B
Text
|
|
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/problem_01 ./problem_01
|
||
|
|
|
||
|
|
# Runtime image
|
||
|
|
FROM debian:bullseye-slim
|
||
|
|
|
||
|
|
# 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/problem_01 /app/problem_01
|
||
|
|
|
||
|
|
# No CMD or ENTRYPOINT, see fly.toml with `cmd` override.
|