FROM rust:1.77-buster as builder
WORKDIR /app
COPY . .
RUN cargo build --release

FROM debian:bullseye-slim
WORKDIR /app

RUN apt-get update && apt-get -y install wget && \
    wget https://files.ivanch.me/api/public/dl/ch3NV0P8/small-image.png && \
    wget https://files.ivanch.me/api/public/dl/jNlXYMLR/big-image.png && \
    wget https://files.ivanch.me/api/public/dl/QdKvaeQI/video.mp4 && \
    wget https://files.ivanch.me/api/public/dl/YD4vmSsO/nginx.html && \
    mkdir -p ./static && \
    mv small-image.png ./static && \
    mv big-image.png ./static && \
    mv video.mp4 ./static && \
    mv nginx.html ./static

COPY --from=builder /app/target/release/ActixAPI .

CMD ["./ActixAPI"]