Spaces:
Runtime error
Runtime error
Download Dockerfile from CleanflowAI/cleanflowai: direct link, hf CLI and curl.
- Browser
- Download file 1.46 kB
-
https://huggingface.co/spaces/CleanflowAI/cleanflowai/resolve/main/Dockerfile
- Command line
-
hf download hf://spaces/CleanflowAI/cleanflowai/Dockerfile
-
curl -L -o Dockerfile https://huggingface.co/spaces/CleanflowAI/cleanflowai/resolve/main/Dockerfile
1.46 kB
| # Stage 1: Build stage - Install dependencies | |
| # Using a specific version is good practice for reproducibility. | |
| FROM python:3.11-slim AS builder | |
| # Set environment variables | |
| ENV PYTHONDONTWRITEBYTECODE 1 | |
| ENV PYTHONUNBUFFERED 1 | |
| # Set the working directory | |
| WORKDIR /app | |
| # Install poetry for dependency management (a robust alternative to pip) | |
| # If you stick with requirements.txt, you can replace this with pip install. | |
| COPY requirements.txt . | |
| # Install dependencies without caching to keep the layer small | |
| RUN pip install --no-cache-dir --upgrade pip && \ | |
| pip install --no-cache-dir -r requirements.txt | |
| # Stage 2: Final stage - Create the production image | |
| FROM python:3.11-slim | |
| # Set the working directory | |
| WORKDIR /app | |
| # Copy the installed dependencies from the builder stage | |
| COPY --from=builder /usr/local/lib/python3.11/site-packages /usr/local/lib/python3.11/site-packages | |
| COPY --from=builder /usr/local/bin /usr/local/bin | |
| # Copy the application source code | |
| COPY . . | |
| # Expose the port that the application will run on | |
| # As per your README, the FastAPI app runs on port 8000. | |
| EXPOSE 8000 | |
| # Command to run the application | |
| # We use Gunicorn as a process manager and Uvicorn for the ASGI server, | |
| # which is the recommended setup for running FastAPI in production. | |
| # The number of workers (-w) can be adjusted based on your server's CPU cores. | |
| CMD ["gunicorn", "-k", "uvicorn.workers.UvicornWorker", "-w", "4", "--bind", "0.0.0.0:8000", "app:app"] |