Kon/Dockerfile

26 lines
815 B
Docker
Raw Normal View History

FROM rust:1.80-alpine3.20@sha256:596c7fa13f7458097b8c88ad83f33420da0341e2f5b544e34d9aa18a22fe11d0 AS chef
2024-07-19 19:56:58 -04:00
ENV RUSTFLAGS="-C target-feature=-crt-static"
2024-05-02 15:26:05 -04:00
RUN apk add --no-cache openssl-dev musl-dev
2024-07-19 19:56:58 -04:00
RUN cargo install cargo-chef
WORKDIR /usr/src/kon
2024-05-02 15:26:05 -04:00
FROM chef AS planner
COPY . .
2024-05-02 15:26:05 -04:00
RUN cargo chef prepare
2024-07-30 05:25:51 -04:00
FROM chef AS dependencies
2024-05-02 15:26:05 -04:00
COPY --from=planner /usr/src/kon/recipe.json recipe.json
RUN cargo chef cook --release
2024-07-30 05:25:51 -04:00
FROM chef AS builder
COPY --from=planner /usr/src/kon/.cargo /usr/src/kon/.cargo
COPY --from=dependencies /usr/src/kon/target /usr/src/kon/target
2024-05-02 15:26:05 -04:00
COPY . .
2024-07-19 19:56:58 -04:00
RUN cargo build -rF production
FROM alpine:3.20@sha256:0a4eaa0eecf5f8c050e5bba433f58c052be7587ee8af3e8b3910ef9ab5fbe9f5
2024-07-22 02:37:19 -04:00
RUN apk add --no-cache libgcc fluidsynth
WORKDIR /kon
2024-05-02 15:26:05 -04:00
COPY --from=builder /usr/src/kon/target/release/kon .
2024-07-19 19:56:58 -04:00
CMD [ "./kon" ]