29 lines
1.1 KiB
Docker
29 lines
1.1 KiB
Docker
ARG RUST_VERSION="1.82.0"
|
|
FROM git.dergrimm.net/dergrimm/muslrust:${RUST_VERSION} AS chef
|
|
|
|
FROM chef AS planner
|
|
WORKDIR /usr/src
|
|
RUN mkdir -p kdash_client/src kdash_protocol/src kdash_server/src && touch kdash_client/src/main.rs kdash_protocol/src/lib.rs kdash_server/src/main.rs
|
|
COPY Cargo.toml Cargo.lock ./
|
|
COPY kdash_client/Cargo.toml kdash_client/Cargo.toml
|
|
COPY kdash_protocol/Cargo.toml kdash_protocol/Cargo.toml
|
|
COPY kdash_server/Cargo.toml kdash_server/Cargo.toml
|
|
RUN cargo chef prepare --recipe-path recipe.json
|
|
|
|
FROM chef AS builder
|
|
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
|
|
WORKDIR /usr/src
|
|
RUN mkdir bin/
|
|
COPY .cargo .cargo
|
|
COPY --from=planner /usr/src/recipe.json .
|
|
RUN cargo chef cook --release --recipe-path recipe.json
|
|
COPY kdash_client kdash_client
|
|
COPY kdash_protocol kdash_protocol
|
|
COPY kdash_server kdash_server
|
|
RUN cargo build --package kdash_server --release && mv target/x86_64-unknown-linux-musl/release/kdash_server bin/kdash_server
|
|
|
|
FROM docker.io/alpine:3
|
|
WORKDIR /usr/src
|
|
COPY --from=builder /usr/src/bin/kdash_server .
|
|
ENTRYPOINT [ "/usr/src/kdash_server" ]
|
|
EXPOSE 8080
|