Download Dockerfile from broadfield-dev/PDF_2_Image-dev: direct link, hf CLI and curl.
- Browser
- Download file 1.16 kB
-
https://huggingface.co/spaces/broadfield-dev/PDF_2_Image-dev/resolve/38686215d94f2907d5010dfcd983fdd4a900fc03/Dockerfile
- Command line
-
hf download hf://spaces/broadfield-dev/PDF_2_Image-dev@38686215d94f2907d5010dfcd983fdd4a900fc03/Dockerfile
-
curl -L -o Dockerfile https://huggingface.co/spaces/broadfield-dev/PDF_2_Image-dev/resolve/38686215d94f2907d5010dfcd983fdd4a900fc03/Dockerfile
1.16 kB
| # Use an official Python runtime as a parent image | |
| FROM python:3.10-slim | |
| # Set environment variables to prevent interactive prompts during installation | |
| ENV DEBIAN_FRONTEND=noninteractive | |
| # Install system dependencies required by the application (only poppler) | |
| RUN apt-get update && apt-get install -y \ | |
| poppler-utils \ | |
| && apt-get clean \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Create a non-root user for security | |
| RUN useradd --create-home --shell /bin/bash appuser | |
| # Set the working directory in the container | |
| WORKDIR /app | |
| # Copy the requirements file and install Python dependencies | |
| # This is done in a separate layer to leverage Docker's build cache | |
| COPY requirements.txt . | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # Copy the rest of the application's code into the container | |
| COPY app.py . | |
| # Change ownership of the app directory to the non-root user | |
| RUN chown -R appuser:appuser /app | |
| # Switch to the non-root user | |
| USER appuser | |
| # Expose the port the Gradio app will run on | |
| EXPOSE 7860 | |
| # The command to run the Gradio application | |
| # Gradio's launch() method will automatically bind to 0.0.0.0 inside Docker. | |
| CMD ["python", "app.py"] |