Spaces:
Running
Running
Download Dockerfile from trigent09/ai-backend: direct link, hf CLI and curl.
- Browser
- Download file 1.02 kB
-
https://huggingface.co/spaces/trigent09/ai-backend/resolve/main/Dockerfile
- Command line
-
hf download hf://spaces/trigent09/ai-backend/Dockerfile
-
curl -L -o Dockerfile https://huggingface.co/spaces/trigent09/ai-backend/resolve/main/Dockerfile
1.02 kB
| # 1. Base image with Python 3.10 | |
| FROM python:3.10-slim | |
| # Container environment settings | |
| ENV PYTHONDONTWRITEBYTECODE=1 \ | |
| PYTHONUNBUFFERED=1 \ | |
| PORT=7860 \ | |
| HF_HOME=/tmp/huggingface \ | |
| TRANSFORMERS_CACHE=/tmp/huggingface | |
| WORKDIR /app | |
| # Install minimal OS build dependencies | |
| RUN apt-get update && apt-get install -y --no-install-recommends \ | |
| build-essential \ | |
| curl \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Install python dependencies | |
| COPY requirements.txt . | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # Create non-root user (Hugging Face Spaces runs as UID 1000) | |
| RUN useradd -m -u 1000 user | |
| # Copy application files | |
| COPY backend ./backend | |
| COPY frontend ./frontend | |
| COPY start.sh . | |
| # Create data directories and grant permissions to UID 1000 | |
| RUN mkdir -p /data /app/data/chroma_db /app/data/uploads /tmp/huggingface && \ | |
| chmod +x /app/start.sh && \ | |
| chown -R 1000:1000 /data /app /tmp/huggingface | |
| USER 1000 | |
| # Hugging Face Spaces listens on port 7860 | |
| EXPOSE 7860 | |
| CMD ["/app/start.sh"] | |