| |
| FROM python:3.11-slim-bullseye AS builder |
|
|
| WORKDIR /subgen |
|
|
| |
| RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \ |
| --mount=type=cache,target=/var/lib/apt,sharing=locked \ |
| apt-get update && apt-get install -y --no-install-recommends \ |
| tzdata |
|
|
| |
| RUN --mount=type=cache,target=/root/.cache/pip \ |
| pip install --prefix=/install torch torchaudio \ |
| --extra-index-url https://download.pytorch.org/whl/cpu |
|
|
| |
| COPY requirements.txt . |
| RUN --mount=type=cache,target=/root/.cache/pip \ |
| pip install --prefix=/install -r requirements.txt \ |
| --extra-index-url https://download.pytorch.org/whl/cpu |
|
|
| |
| FROM python:3.11-slim-bullseye AS runtime |
|
|
| WORKDIR /subgen |
|
|
| RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \ |
| --mount=type=cache,target=/var/lib/apt,sharing=locked \ |
| apt-get update && apt-get install -y --no-install-recommends \ |
| ffmpeg curl gosu tzdata \ |
| && rm -rf /var/lib/apt/lists/* |
|
|
| |
| COPY --from=builder /install /usr/local |
|
|
| |
| COPY launcher.py subgen.py language_code.py /subgen/ |
|
|
| RUN mkdir -p /cache && chmod 777 /cache |
|
|
| ENV XDG_CACHE_HOME=/cache \ |
| HF_HOME=/cache/huggingface \ |
| MPLCONFIGDIR=/cache/matplotlib \ |
| PYTHONUNBUFFERED=1 |
|
|
| COPY entrypoint.sh /entrypoint.sh |
| RUN chmod +x /entrypoint.sh |
| ENTRYPOINT ["/entrypoint.sh"] |
| CMD ["python3", "launcher.py"] |
|
|