diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..dfc5c47 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,34 @@ +# ---- Étape 1 : Build ---- +FROM rust:1.82-alpine AS builder + + +RUN apk add --no-cache musl-dev pkgconfig openssl-dev build-base + +WORKDIR /app + + +RUN rustup target add x86_64-unknown-linux-musl + +COPY Cargo.toml Cargo.lock ./ +RUN mkdir src && echo "fn main() {}" > src/main.rs +RUN cargo build --release --target x86_64-unknown-linux-musl +RUN rm -rf src + +COPY src ./src +RUN cargo build --release --target x86_64-unknown-linux-musl + +# ---- Étape 2 : Runtime ---- +FROM alpine:3.20 AS runtime + +RUN apk add --no-cache ca-certificates ffmpeg rsync yt-dlp openssh + +WORKDIR /app + +COPY --from=builder /app/target/x86_64-unknown-linux-musl/release/src /app/api + +RUN adduser -D appuser +USER appuser + +EXPOSE 8080 + +CMD ["./api"] \ No newline at end of file