2024-08-02 23:04:19 -04:00
|
|
|
FROM rust:1.80-alpine3.20 AS chef
|
2024-07-19 19:56:58 -04:00
|
|
|
ENV RUSTFLAGS="-C target-feature=-crt-static"
|
2024-08-08 02:37:55 -04:00
|
|
|
ARG GIT_HASH
|
|
|
|
ENV GIT_COMMIT_HASH=${GIT_HASH}
|
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
|
2024-08-02 23:04:19 -04:00
|
|
|
WORKDIR /builder
|
2024-05-02 15:26:05 -04:00
|
|
|
|
|
|
|
FROM chef AS planner
|
2023-12-08 06:25:44 -05:00
|
|
|
COPY . .
|
2024-05-02 15:26:05 -04:00
|
|
|
RUN cargo chef prepare
|
|
|
|
|
2024-07-30 05:25:51 -04:00
|
|
|
FROM chef AS builder
|
2024-08-02 23:04:19 -04:00
|
|
|
COPY --from=planner /builder/recipe.json recipe.json
|
|
|
|
RUN cargo chef cook --release
|
2024-05-02 15:26:05 -04:00
|
|
|
COPY . .
|
2024-08-02 23:04:19 -04:00
|
|
|
RUN cargo build --offline -rF production
|
2023-12-08 06:25:44 -05:00
|
|
|
|
2024-08-02 23:04:19 -04:00
|
|
|
FROM alpine:edge
|
|
|
|
LABEL org.opencontainers.image.source="https://git.toast-server.net/toast/Kon"
|
2024-07-22 02:37:19 -04:00
|
|
|
RUN apk add --no-cache libgcc fluidsynth
|
2023-12-08 06:25:44 -05:00
|
|
|
WORKDIR /kon
|
2024-08-02 23:04:19 -04:00
|
|
|
COPY --from=builder /builder/target/release/kon .
|
2024-07-19 19:56:58 -04:00
|
|
|
CMD [ "./kon" ]
|