Download Dockerfile from Berzelius255/Computer-Vision-Agri-App: direct link, hf CLI and curl.
- Browser
- Download file 1.12 kB
-
https://huggingface.co/spaces/Berzelius255/Computer-Vision-Agri-App/resolve/main/Dockerfile
- Command line
-
hf download hf://spaces/Berzelius255/Computer-Vision-Agri-App/Dockerfile
-
curl -L -o Dockerfile https://huggingface.co/spaces/Berzelius255/Computer-Vision-Agri-App/resolve/main/Dockerfile
1.12 kB
| # Read the doc: https://huggingface.co/docs/hub/spaces-sdks-docker | |
| # you will also find guides on how best to write your Dockerfile | |
| FROM python:3.9 | |
| RUN useradd -m -u 1000 user | |
| USER user | |
| ENV PATH="/home/user/.local/bin:$PATH" | |
| WORKDIR /app | |
| # Copy application files | |
| COPY app.py . | |
| COPY models/best.pt ./models/best.pt | |
| COPY --chown=user ./requirements.txt requirements.txt | |
| RUN pip install --no-cache-dir --upgrade -r requirements.txt | |
| # Install system dependencies for OpenCV, Ollama, and supervisord | |
| RUN apt-get update && apt-get install -y \ | |
| libgl1-mesa-glx \ | |
| libglib2.0-0 \ | |
| curl \ | |
| supervisor \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Install Ollama | |
| RUN curl -fsSL https://ollama.ai/install.sh | sh && \ | |
| apt-get clean && rm -rf /var/lib/apt/lists/* | |
| COPY --chown=user . /app | |
| # Expose port 8501 for Streamlit | |
| EXPOSE 8501 | |
| # Health check for Streamlit | |
| HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \ | |
| CMD curl --fail http://localhost:8501/_stcore/health || exit 1 | |
| # Start Streamlit | |
| ENTRYPOINT ["streamlit", "run", "app.py", "--server.port=8501", "--server.address=0.0.0.0"] |