Spaces:
Sleeping
Sleeping
Download Dockerfile from rimandeep/ai-devops-backend: direct link, hf CLI and curl.
- Browser
- Download file 768 Bytes
-
https://huggingface.co/spaces/rimandeep/ai-devops-backend/resolve/main/Dockerfile
- Command line
-
hf download hf://spaces/rimandeep/ai-devops-backend/Dockerfile
-
curl -L -o Dockerfile https://huggingface.co/spaces/rimandeep/ai-devops-backend/resolve/main/Dockerfile
768 Bytes
| # Use slim Python image — smaller and more secure than full image | |
| FROM python:3.11-slim | |
| # Never run as root in production containers | |
| RUN useradd --create-home appuser | |
| WORKDIR /app | |
| # Copy and install dependencies first (better layer caching) | |
| # If requirements.txt hasn't changed, Docker uses cached layer | |
| COPY requirements.txt . | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # Copy application code | |
| COPY app/ ./app/ | |
| # Switch to non-root user | |
| USER appuser | |
| EXPOSE 7860 | |
| # Health check — Docker will mark container unhealthy if this fails | |
| HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \ | |
| CMD python -c "import httpx; httpx.get('http://localhost:7860/health')" | |
| CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"] |