File size: 963 Bytes
c091d8d
 
 
 
43b4543
 
c091d8d
 
97283f2
c091d8d
 
b23da50
 
 
 
 
 
3ad29b0
c091d8d
3ad29b0
 
 
97ecbf3
c091d8d
 
3ad29b0
c091d8d
 
 
 
97ecbf3
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
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"]