Download Dockerfile from Anjali04-15/fastapi-classification-model: direct link, hf CLI and curl.
- Browser
- Download file 984 Bytes
-
https://huggingface.co/spaces/Anjali04-15/fastapi-classification-model/resolve/main/Dockerfile
- Command line
-
hf download hf://spaces/Anjali04-15/fastapi-classification-model/Dockerfile
-
curl -L -o Dockerfile https://huggingface.co/spaces/Anjali04-15/fastapi-classification-model/resolve/main/Dockerfile
984 Bytes
| # Use official Python slim image | |
| FROM python:3.9-slim | |
| # Set working directory inside the container | |
| WORKDIR /app | |
| # Copy all files from current directory to /app in the container | |
| COPY . /app | |
| # Install system dependencies for PIL and PyTorch | |
| RUN apt-get update && apt-get install -y \ | |
| gcc \ | |
| libgl1 \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Upgrade pip and install python dependencies | |
| RUN pip install --upgrade pip | |
| RUN pip install -r requirements.txt | |
| # create cache folder with write permissions | |
| RUN mkdir -p /app/.cache/huggingface && chmod -R 777 /app/.cache/huggingface | |
| # set environment variables for huggingface cache | |
| ENV HF_HOME=/app/.cache/huggingface | |
| ENV TRANSFORMERS_CACHE=/app/.cache/huggingface/transformers | |
| ENV HF_DATASETS_CACHE=/app/.cache/huggingface/datasets | |
| # Expose the port your FastAPI app will run on (7860 is standard on Hugging Face Spaces) | |
| EXPOSE 7860 | |
| # Run the FastAPI app with uvicorn | |
| CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"] |