(add):Dockerfile
This commit is contained in:
parent
0ceff17943
commit
f89bcce7e7
34
Dockerfile
Normal file
34
Dockerfile
Normal file
@ -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"]
|
||||||
Loading…
x
Reference in New Issue
Block a user