spacebot/Dockerfile

35 lines
1 KiB
Text
Raw Normal View History

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
RUN apk add --no-cache openssl-dev musl-dev openssl-libs-static lld git g++ make
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 . .
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 && \
mkdir -p /app/dist && \
cp /app/target/x86_64-unknown-linux-musl/release/professor /app/dist/
2025-10-15 21:24:33 +02:00
2026-05-13 09:39:58 +02:00
FROM scratch AS final
2025-10-15 21:24:33 +02:00
WORKDIR /app
2026-05-13 09:39:58 +02:00
COPY --from=builder /app/dist/professor ./splatie
ENTRYPOINT ["./splatie"]