FROM python:3.12-slim ARG TORCH_VERSION=2.14.1 # Install the CPU wheel explicitly before Laya so pip does not select the much # larger CUDA build. Model weights remain runtime-only in the mounted cache. RUN python -m pip install --no-cache-dir \ "torch==${TORCH_VERSION}" \ --index-url https://download.pytorch.org/whl/cpu \ && python -m pip install --no-cache-dir "laya[serve]>=0.3.22,<0.4" \ && python -m pip check \ && python -c "import torch; assert torch.version.cuda is None, torch.version.cuda" ENV HF_HOME=/models \ LAYA_HOST=0.0.0.0 \ LAYA_PORT=8000 \ LAYA_PRELOAD=0 \ LAYA_DEVICE=cpu VOLUME ["/models"] EXPOSE 8000 CMD ["laya-serve"]