spacebot/Dockerfile

41 lines
1.3 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
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 . .
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-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
RUN apk add --no-cache ffmpeg python3 curl libstdc++ \
&& curl -L https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp -o /usr/local/bin/yt-dlp \
&& chmod a+rx /usr/local/bin/yt-dlp \
&& apk del curl
2026-05-13 09:39:58 +02:00
COPY --from=builder /app/dist/professor ./splatie
ENTRYPOINT ["./splatie"]