Spaces:
Sleeping
Sleeping
Download Dockerfile from Silvio0/product-return-api: direct link, hf CLI and curl.
- Browser
- Download file 1.17 kB
-
https://huggingface.co/spaces/Silvio0/product-return-api/resolve/main/Dockerfile
- Command line
-
hf download hf://spaces/Silvio0/product-return-api/Dockerfile
-
curl -L -o Dockerfile https://huggingface.co/spaces/Silvio0/product-return-api/resolve/main/Dockerfile
1.17 kB
| # ============================================================================== | |
| # DOCKERFILE FOR PRODUCT RETURN PREDICTION API | |
| # ============================================================================== | |
| # 1. Use a lightweight official Python base image to keep the container fast and small | |
| FROM python:3.9-slim | |
| # 2. Set the working directory inside the container | |
| WORKDIR /app | |
| # 3. Copy requirements first (optimizes Docker cache for faster rebuilds) | |
| COPY requirements.txt . | |
| # 4. Install dependencies | |
| # --no-cache-dir reduces image size by preventing pip from caching packages | |
| RUN pip install --no-cache-dir --upgrade pip && \ | |
| pip install --no-cache-dir -r requirements.txt | |
| # 5. Copy all application code (api.py, function.py, and model folders) into the container | |
| COPY . . | |
| # 6. Adjust directory permissions | |
| # Essential for cloud deployments (like Hugging Face Spaces) to allow read/write operations | |
| RUN chmod -R 777 /app | |
| # 7. Command to start the FastAPI server | |
| # IMPORTANT: "api:app" points to the 'app' object inside 'api.py' | |
| # Port 7860 is the default port required by Hugging Face Spaces | |
| CMD ["uvicorn", "api:app", "--host", "0.0.0.0", "--port", "7860"] |