test / Dockerfile
CyberWaifu's picture
Sking image-to-Minecraft-skin pipeline (AGPL-3.0)
fbe2cc1 verified
Raw History Blame Contribute Delete
2.46 kB
# ---------------------------------------------------------------------------
# OPTIONAL fallback: dedicated-GPU Docker Space (e.g. 1x L4, $0.80/hr).
#
# The primary target of this repo is a free **ZeroGPU Gradio** Space, which does
# not use a Dockerfile at all. Use this only if ZeroGPU proves too fragile or
# the 5 min/day quota is not enough -- it removes the quota entirely, lets you
# pin EntropyDrop's exact verified dependency versions, and bakes the ~20 GB of
# weights into the image so there is no cold-start download.
#
# To switch: Settings -> Space hardware -> pick a GPU tier, and change
# Settings -> SDK to Docker. Then delete `sdk: gradio` from README.md's
# frontmatter (Docker Spaces read no app_file/sdk keys).
#
# Build requires network. Image size lands around 30 GB, so builds are slow;
# HF caches layers between builds.
# ---------------------------------------------------------------------------
FROM nvidia/cuda:12.8.1-cudnn-runtime-ubuntu22.04
ENV DEBIAN_FRONTEND=noninteractive \
PYTHONUNBUFFERED=1 \
PIP_NO_CACHE_DIR=1 \
HF_HOME=/opt/hf-home \
SKING_WEIGHTS_ROOT=/opt/weights
# Python 3.12 is what SKING_DDJ_v104 was verified with.
RUN apt-get update && apt-get install -y --no-install-recommends \
software-properties-common git curl ca-certificates build-essential \
&& add-apt-repository -y ppa:deadsnakes/ppa \
&& apt-get update && apt-get install -y --no-install-recommends \
python3.12 python3.12-venv python3.12-dev \
&& curl -sS https://bootstrap.pypa.io/get-pip.py | python3.12 \
&& ln -sf /usr/bin/python3.12 /usr/local/bin/python \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
# 1. Exact CUDA-matched PyTorch first, as EntropyDrop's README instructs.
RUN python -m pip install --index-url https://download.pytorch.org/whl/cu128 \
torch==2.8.0 torchvision==0.23.0
# 2. Remaining pinned deps (mirrors SKING_DDJ_v104/tested_environments.json).
COPY requirements-docker.txt /tmp/requirements-docker.txt
RUN python -m pip install -r /tmp/requirements-docker.txt
# 3. Bake the weights into the image: no runtime download, fast cold start.
COPY sking_pipeline /app/sking_pipeline
RUN python -m sking_pipeline.weights
# 4. App last, so code edits do not invalidate the 20 GB layer above.
COPY app.py /app/app.py
COPY README.md NOTICE.md /app/
EXPOSE 7860
# Docker Spaces must serve on 7860 and bind 0.0.0.0 -- app.py already does both.
CMD ["python", "app.py"]