2025-10-15 21:24:33 +02:00
|
|
|
# syntax=docker/dockerfile:1
|
2026-05-13 09:39:58 +02:00
|
|
|
FROM rust:alpine AS chef
|
2026-05-18 21:28:28 +02:00
|
|
|
RUN apk add --no-cache openssl-dev musl-dev openssl-libs-static lld git g++ make cmake
|
2026-05-13 09:39:58 +02:00
|
|
|
RUN cargo install cargo-chef
|
|
|
|
|
WORKDIR /app
|
2025-10-15 21:24:33 +02:00
|
|
|
|
2026-05-13 09:39:58 +02:00
|
|
|
FROM chef AS planner
|
|
|
|
|
COPY . .
|
|
|
|
|
RUN git submodule update --init
|
|
|
|
|
RUN cargo chef prepare --recipe-path recipe.json
|
2025-10-15 21:24:33 +02:00
|
|
|
|
2026-05-13 09:39:58 +02:00
|
|
|
FROM chef AS builder
|
|
|
|
|
COPY --from=planner /app/recipe.json recipe.json
|
2025-10-15 21:24:33 +02:00
|
|
|
|
2026-05-13 09:39:58 +02:00
|
|
|
ENV OPENSSL_LIB_DIR=/usr/lib
|
|
|
|
|
ENV OPENSSL_INCLUDE_DIR=/usr/include/openssl
|
|
|
|
|
ENV OPENSSL_STATIC=1
|
2025-10-15 21:24:33 +02:00
|
|
|
|
2026-05-13 09:39:58 +02:00
|
|
|
RUN --mount=type=cache,target=/usr/local/cargo/registry \
|
|
|
|
|
--mount=type=cache,target=/app/target \
|
|
|
|
|
cargo chef cook --release --recipe-path recipe.json --target x86_64-unknown-linux-musl
|
2025-10-15 21:24:33 +02:00
|
|
|
|
2026-05-13 09:39:58 +02:00
|
|
|
COPY . .
|
2025-10-16 11:54:31 +02:00
|
|
|
RUN git submodule update --init
|
|
|
|
|
|
2026-05-13 09:39:58 +02:00
|
|
|
RUN --mount=type=cache,target=/usr/local/cargo/registry \
|
|
|
|
|
--mount=type=cache,target=/app/target \
|
|
|
|
|
cargo build --release --target x86_64-unknown-linux-musl && \
|
2026-08-08 20:22:30 +02:00
|
|
|
mkdir -p /app/dist
|
|
|
|
|
|
2026-08-08 20:02:12 +02:00
|
|
|
COPY --from=builder /app/target/x86_64-unknown-linux-musl/release/spacebot /app/dist/
|
2025-10-15 21:24:33 +02:00
|
|
|
|
2026-05-17 17:55:38 +02:00
|
|
|
FROM alpine:latest AS final
|
2025-10-15 21:24:33 +02:00
|
|
|
WORKDIR /app
|
2026-05-17 17:55:38 +02:00
|
|
|
|
2026-08-08 19:37:02 +02:00
|
|
|
RUN apk add --no-cache python3 libstdc++
|
2026-05-17 17:55:38 +02:00
|
|
|
|
2026-08-08 20:02:12 +02:00
|
|
|
COPY --from=builder /app/dist/spacebot ./spacebot
|
|
|
|
|
ENTRYPOINT ["./spacebot"]
|