Spaces:
Sleeping
Sleeping
Download Dockerfile from Ansh99/X-Rays_Radiologist: direct link, hf CLI and curl.
- Browser
- Download file 1.07 kB
-
https://huggingface.co/spaces/Ansh99/X-Rays_Radiologist/resolve/main/Dockerfile
- Command line
-
hf download hf://spaces/Ansh99/X-Rays_Radiologist/Dockerfile
-
curl -L -o Dockerfile https://huggingface.co/spaces/Ansh99/X-Rays_Radiologist/resolve/main/Dockerfile
1.07 kB
| # Use Python 3.9 Slim | |
| FROM python:3.9-slim | |
| # Set working directory | |
| WORKDIR /code | |
| # Install system dependencies | |
| RUN apt-get update && apt-get install -y \ | |
| libgl1 \ | |
| libglib2.0-0 \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Create a non-root user | |
| RUN useradd -m -u 1000 user | |
| # Give the "user" permission to write to /code | |
| # This allows the app to create the 'uploads' folder dynamically | |
| RUN chown user:user /code | |
| # Switch to user | |
| USER user | |
| # Set environment paths | |
| ENV HOME=/home/user \ | |
| PATH=/home/user/.local/bin:$PATH | |
| # Copy requirements and install | |
| COPY --chown=user ./requirements.txt requirements.txt | |
| RUN pip install --no-cache-dir --upgrade -r requirements.txt | |
| # Copy application code | |
| COPY --chown=user . . | |
| # Pre-create the uploads folder to be safe | |
| RUN mkdir -p uploads | |
| # Fix cache permissions (Prevents "Permission Denied" on internal cache files) | |
| RUN mkdir -p /home/user/.cache && chmod -R 777 /home/user/.cache | |
| # Expose port | |
| EXPOSE 7860 | |
| # Run the application | |
| CMD ["python", "-m", "gunicorn", "-b", "0.0.0.0:7860", "app:app", "--timeout", "120"] |