mirror of
https://codeberg.org/tyy/aspm
synced 2024-12-22 15:59:29 -07:00
26 lines
949 B
Text
26 lines
949 B
Text
|
# Using the `rust-musl-builder` as base image, instead of
|
||
|
# the official Rust toolchain
|
||
|
FROM clux/muslrust:1.79.0-stable AS chef
|
||
|
USER root
|
||
|
# Install cargo-chef
|
||
|
RUN cargo install cargo-chef --locked
|
||
|
WORKDIR /app
|
||
|
|
||
|
FROM chef AS planner
|
||
|
COPY . .
|
||
|
# Cache all dependencies for the server
|
||
|
RUN cargo chef prepare --recipe-path recipe.json --bin naja-server
|
||
|
|
||
|
FROM chef AS builder
|
||
|
COPY --from=planner /app/recipe.json recipe.json
|
||
|
# Build dependencies
|
||
|
RUN cargo chef cook --release --target x86_64-unknown-linux-musl --recipe-path recipe.json --package naja-server
|
||
|
COPY . .
|
||
|
# Build main binary
|
||
|
RUN cargo build --release --target x86_64-unknown-linux-musl --package naja-server
|
||
|
|
||
|
FROM alpine AS runtime
|
||
|
COPY --from=builder /app/target/x86_64-unknown-linux-musl/release/naja-server /usr/local/bin/
|
||
|
HEALTHCHECK --interval=10s --timeout=3s \
|
||
|
CMD wget --no-verbose --tries=1 --spider http://localhost:$NAJA_BIND_PORT/ || exit 1
|
||
|
CMD ["/usr/local/bin/naja-server"]
|