2026-05-20 09:27:50 +07:00
|
|
|
FROM lukemathwalker/cargo-chef:latest-rust-slim-bookworm AS planner
|
|
|
|
|
WORKDIR /app
|
|
|
|
|
|
|
|
|
|
COPY . .
|
|
|
|
|
RUN cargo chef prepare --recipe-path recipe.json
|
|
|
|
|
|
|
|
|
|
FROM lukemathwalker/cargo-chef:latest AS cacher
|
|
|
|
|
WORKDIR /app
|
|
|
|
|
COPY --from=planner /app/recipe.json recipe.json
|
|
|
|
|
# Build and cache only the dependencies
|
|
|
|
|
RUN cargo chef cook --release --recipe-path recipe.json
|
|
|
|
|
|
2026-02-27 14:09:21 +07:00
|
|
|
FROM rust:latest AS builder
|
2026-05-20 09:27:50 +07:00
|
|
|
WORKDIR /app
|
2026-02-27 14:09:21 +07:00
|
|
|
|
|
|
|
|
RUN apt-get update && apt-get install -y \
|
|
|
|
|
pkg-config \
|
|
|
|
|
libssl-dev
|
|
|
|
|
|
2026-05-20 09:27:50 +07:00
|
|
|
COPY --from=cacher /app/target target
|
|
|
|
|
COPY --from=cacher /usr/local/cargo /usr/local/cargo
|
2026-02-27 14:09:21 +07:00
|
|
|
|
2026-05-20 09:27:50 +07:00
|
|
|
COPY . .
|
2026-02-27 14:09:21 +07:00
|
|
|
|
2026-05-20 09:27:50 +07:00
|
|
|
COPY .env ./.env
|
2026-02-27 14:09:21 +07:00
|
|
|
|
2026-05-20 09:27:50 +07:00
|
|
|
RUN cargo build --release --bin server-mark2-dev
|
2026-02-27 14:09:21 +07:00
|
|
|
|
|
|
|
|
|
2026-05-20 09:27:50 +07:00
|
|
|
FROM debian:bookworm-slim AS runtime
|
2026-02-27 15:22:01 +07:00
|
|
|
WORKDIR /app
|
2026-05-20 09:27:50 +07:00
|
|
|
COPY --from=builder /app/target/release/server-mark2-dev /usr/local/bin/server-mark2-dev
|
|
|
|
|
COPY --from=builder /app/.env /usr/local/bin/.env
|
2026-02-27 14:09:21 +07:00
|
|
|
|
2026-05-20 09:27:50 +07:00
|
|
|
CMD [ "server-mark2-dev" ]
|