Files
Transcriptarr/Dockerfile.cpu
2025-03-27 19:37:38 -06:00

34 lines
1.0 KiB
Docker

# === Stage 1: Build dependencies and install packages ===
FROM python:3.11-slim-bullseye AS builder
WORKDIR /subgen
# Install required build dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
ffmpeg \
git \
tzdata \
&& rm -rf /var/lib/apt/lists/*
# Copy and install dependencies
COPY requirements.txt .
RUN pip install --no-cache-dir --prefix=/install torch torchaudio --extra-index-url https://download.pytorch.org/whl/cpu && pip install --no-cache-dir --prefix=/install -r requirements.txt --extra-index-url https://download.pytorch.org/whl/cpu
# === Stage 2: Create a minimal runtime image ===
FROM python:3.11-slim-bullseye AS runtime
WORKDIR /subgen
# Install only required runtime dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
ffmpeg \
&& rm -rf /var/lib/apt/lists/*
# Copy only necessary files from builder stage
COPY --from=builder /install /usr/local
# Copy source code
COPY launcher.py subgen.py language_code.py /subgen/
CMD ["python3", "launcher.py"]