Spaces:
Sleeping
Sleeping
Download Dockerfile.fastapi from KOHSEC-TEAM/C9-AI: direct link, hf CLI and curl.
- Browser
- Download file 650 Bytes
-
https://huggingface.co/spaces/KOHSEC-TEAM/C9-AI/resolve/refs%2Fpr%2F1/Dockerfile.fastapi
- Command line
-
hf download hf://spaces/KOHSEC-TEAM/C9-AI@refs/pr/1/Dockerfile.fastapi
-
curl -L -o Dockerfile.fastapi https://huggingface.co/spaces/KOHSEC-TEAM/C9-AI/resolve/refs%2Fpr%2F1/Dockerfile.fastapi
650 Bytes
| FROM python:3.9-slim | |
| # Create a non-root user for security (Hugging Face Spaces best practice) | |
| RUN useradd -m -u 1000 user | |
| USER user | |
| ENV PATH="/home/user/.local/bin:$PATH" | |
| WORKDIR /app | |
| # Copy requirements first for better Docker layer caching | |
| COPY --chown=user requirements.txt /app/requirements.txt | |
| # Install dependencies | |
| RUN pip install --no-cache-dir --upgrade pip && \ | |
| pip install --no-cache-dir --user -r requirements.txt | |
| # Copy application code | |
| COPY --chown=user . /app | |
| # Expose port 7860 (Hugging Face Spaces standard) | |
| EXPOSE 7860 | |
| # Run FastAPI with uvicorn | |
| CMD ["uvicorn", "app_fastapi:app", "--host", "0.0.0.0", "--port", "7860"] | |