mirror-chhoto-url/Dockerfile

30 lines
886 B
Docker
Raw Normal View History

ARG target=x86_64-unknown-linux-musl
ENV target=$target
FROM lukemathwalker/cargo-chef:latest-rust-slim AS chef
WORKDIR /chhoto-url
2020-02-14 19:17:56 +00:00
FROM chef as planner
COPY ./actix/Cargo.toml ./actix/Cargo.lock .
COPY ./actix/src ./src
RUN cargo chef prepare --recipe-path recipe.json
FROM chef as builder
RUN apt-get update && apt-get install -y musl-tools
RUN rustup target add x86_64-unknown-linux-musl
2020-02-14 19:17:56 +00:00
COPY --from=planner /chhoto-url/recipe.json recipe.json
# Build dependencies - this is the caching Docker layer
RUN cargo chef cook --release --target=$target --recipe-path recipe.json
2020-02-14 19:17:56 +00:00
COPY ./actix/Cargo.toml ./actix/Cargo.lock .
2023-04-03 03:26:23 +00:00
COPY ./actix/src ./src
# Build application
RUN cargo build --release --target=$target --locked --bin chhoto-url
2023-04-02 21:53:55 +00:00
FROM scratch
COPY --from=builder /chhoto-url/target/$target/release/chhoto-url /chhoto-url
COPY ./resources /resources
ENTRYPOINT ["/chhoto-url"]
2023-04-03 03:26:23 +00:00