deezer / Dockerfile
recycleactor's picture
Upload Dockerfile
3ad29b0 verified
Raw
History Blame Contribute Delete
963 Bytes
FROM rust:latest as builder
WORKDIR /usr/src/app
COPY . .
RUN sh -c 'sig="$(head -c 3 src/main.rs | od -An -tx1 | tr -d " \n")"; if [ "$sig" = "efbbbf" ]; then tail -c +4 src/main.rs > src/main.rs.nobom && mv src/main.rs.nobom src/main.rs; fi' \
&& cargo build --release && mv ./target/release/dzmedia ./dzmedia
# Runtime image
FROM ubuntu:24.04
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
ca-certificates \
python3 \
python3-pip \
ffmpeg \
&& pip3 install --no-cache-dir --break-system-packages yt-dlp \
&& rm -rf /var/lib/apt/lists/*
# HuggingFace требует user с UID 1000, он уже существует в Ubuntu 24.04
USER 1000
ENV HOME=/home/ubuntu
WORKDIR $HOME/app
# Get compiled binaries from builder's cargo install directory
COPY --from=builder --chown=1000:1000 /usr/src/app/dzmedia $HOME/app/dzmedia
ENV BIND_ADDR=0.0.0.0
ENV PORT=7860
EXPOSE 7860
CMD ["./dzmedia"]