Download Dockerfile from rastof9/ads: direct link, hf CLI and curl.
- Browser
- Download file 1.01 kB
-
https://huggingface.co/spaces/rastof9/ads/resolve/main/Dockerfile
- Command line
-
hf download hf://spaces/rastof9/ads/Dockerfile
-
curl -L -o Dockerfile https://huggingface.co/spaces/rastof9/ads/resolve/main/Dockerfile
1.01 kB
| FROM python:3.9-slim | |
| # Set environment variables | |
| ENV FLASK_APP=app.py | |
| ENV FLASK_ENV=production | |
| ENV PATH="/home/appuser/.local/bin:$PATH" | |
| # Install system dependencies for OpenCV and other requirements | |
| RUN apt-get update && apt-get install -y \ | |
| libgl1-mesa-glx \ | |
| libglib2.0-0 \ | |
| libsm6 \ | |
| libxext6 \ | |
| libxrender-dev \ | |
| tesseract-ocr \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Create a non-root user | |
| RUN useradd -m appuser && mkdir -p /app /app/instance && chown -R appuser:appuser /app | |
| # Set the working directory | |
| WORKDIR /app | |
| # Copy requirements and install dependencies | |
| COPY --chown=appuser:appuser requirements.txt . | |
| RUN pip install --no-cache-dir "numpy<2.0.0" && \ | |
| pip install --no-cache-dir -r requirements.txt | |
| # Copy the application code | |
| COPY --chown=appuser:appuser . . | |
| # Switch to non-root user | |
| USER appuser | |
| # Expose the port | |
| EXPOSE 5000 | |
| # Run the application using gunicorn with config file | |
| CMD ["gunicorn", "--config=./gunicorn.conf.py", "--workers=2", "app:create_app()"] |