Download Dockerfile from Mohansree/bsure-api: direct link, hf CLI and curl.
- Browser
- Download file 911 Bytes
-
https://huggingface.co/spaces/Mohansree/bsure-api/resolve/main/Dockerfile
- Command line
-
hf download hf://spaces/Mohansree/bsure-api/Dockerfile
-
curl -L -o Dockerfile https://huggingface.co/spaces/Mohansree/bsure-api/resolve/main/Dockerfile
911 Bytes
| # Use the official Python 3.10 image which is stable and widely supported | |
| FROM python:3.10 | |
| # Set the working directory to /code | |
| WORKDIR /code | |
| # Copy the requirements file | |
| COPY ./requirements.txt /code/requirements.txt | |
| # Install the dependencies | |
| # using --no-cache-dir to keep the image small | |
| RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt | |
| # Copy the application code | |
| COPY . /code | |
| # Fix permissions: | |
| # 1. Create the static upload directory if it doesn't exist | |
| # 2. Give write permissions to the current directory (needed for SQLite .db file creation/updates) | |
| # Hugging Face Spaces runs with user ID 1000, so we ensure the directory is writable. | |
| RUN mkdir -p /code/static/uploads && \ | |
| chmod -R 777 /code | |
| # Expose port 7860 (This is the required port for Hugging Face Spaces) | |
| EXPOSE 7860 | |
| # Run the app using uvicorn | |
| CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"] | |