FROM python:3.11-slim # CPU-only PyTorch keeps the image small RUN pip install --no-cache-dir torch torchvision --index-url https://download.pytorch.org/whl/cpu COPY requirements.txt /tmp/requirements.txt RUN pip install --no-cache-dir -r /tmp/requirements.txt # Non-root user (Hugging Face Spaces convention) RUN useradd -m -u 1000 user USER user WORKDIR /home/user/app COPY --chown=user . /home/user/app # Gallery assets ship as one LFS tar (same channel as the model weights, # which is known to survive the build) — unpack to the paths the app expects. RUN tar -xf static_assets.tar -C static && rm static_assets.tar \ && echo "static tree after unpack:" && find static -name '*.jpg' | wc -l ENV PORT=7860 EXPOSE 7860 CMD ["python", "app.py"]