Spaces:
Sleeping
Sleeping
Download Dockerfile from Nickanas/PaySim-Fraud: direct link, hf CLI and curl.
- Browser
- Download file 1.1 kB
-
https://huggingface.co/spaces/Nickanas/PaySim-Fraud/resolve/main/Dockerfile
- Command line
-
hf download hf://spaces/Nickanas/PaySim-Fraud/Dockerfile
-
curl -L -o Dockerfile https://huggingface.co/spaces/Nickanas/PaySim-Fraud/resolve/main/Dockerfile
1.1 kB
| # 1. Lightweight Python matching the dev version | |
| FROM python:3.13-slim | |
| # 2. Run as a non-root user. Hugging Face Spaces run containers as UID 1000; | |
| # creating a matching user with a writable home avoids permission errors. | |
| # (This is also good security practice for AWS / Docker Hub.) | |
| RUN useradd -m -u 1000 user | |
| USER user | |
| ENV HOME=/home/user \ | |
| PATH=/home/user/.local/bin:$PATH | |
| # 3. Working directory inside the user's home | |
| WORKDIR /home/user/app | |
| # 4. Copy the serving dependency file first (better layer caching) | |
| COPY --chown=user requirements-serve.txt . | |
| # 5. Install CPU-only torch, then the serving-only dependencies | |
| RUN pip install --user --upgrade pip \ | |
| && pip install --user torch --index-url https://download.pytorch.org/whl/cpu \ | |
| && pip install --user -r requirements-serve.txt | |
| # 6. Copy the project (including artifacts/, needed to serve) | |
| COPY --chown=user . . | |
| # 7. Unbuffered logs + make `src` importable | |
| ENV PYTHONUNBUFFERED=1 \ | |
| PYTHONPATH=/home/user/app | |
| EXPOSE 8000 | |
| CMD ["python", "-m", "uvicorn", "src.app.main:app", "--host", "0.0.0.0", "--port", "8000"] | |