2024-07-19 19:56:58 -04:00
|
|
|
FROM rust:1.79-alpine3.20 AS chef
|
|
|
|
ENV RUSTFLAGS="-C target-feature=-crt-static"
|
2024-03-25 22:04:12 -04:00
|
|
|
ARG CARGO_TOKEN
|
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
|
2023-12-08 06:25:44 -05:00
|
|
|
WORKDIR /usr/src/kon
|
2024-05-02 15:26:05 -04:00
|
|
|
|
|
|
|
FROM chef AS planner
|
2023-12-08 06:25:44 -05:00
|
|
|
COPY . .
|
2024-03-25 22:04:12 -04:00
|
|
|
RUN mkdir -p .cargo && \
|
|
|
|
printf '[registries.gitea]\nindex = "sparse+https://git.toast-server.net/api/packages/toast/cargo/"\ntoken = "Bearer %s"\n' "$CARGO_TOKEN" >> .cargo/config.toml
|
2024-05-02 15:26:05 -04:00
|
|
|
RUN cargo chef prepare
|
|
|
|
|
|
|
|
FROM chef AS builder
|
|
|
|
COPY --from=planner /usr/src/kon/recipe.json recipe.json
|
|
|
|
RUN cargo chef cook --release
|
|
|
|
COPY . .
|
2024-07-19 19:56:58 -04:00
|
|
|
RUN cargo build -rF production
|
2023-12-08 06:25:44 -05:00
|
|
|
|
2024-07-19 19:56:58 -04:00
|
|
|
FROM alpine:3.20
|
2024-05-02 15:26:05 -04:00
|
|
|
RUN apk add --no-cache libgcc
|
2023-12-08 06:25:44 -05:00
|
|
|
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" ]
|