Spaces:
Runtime error
Runtime error
Download Dockerfile from SII-gelingli/echem-agent: direct link, hf CLI and curl.
- Browser
- Download file 1.57 kB
-
https://huggingface.co/spaces/SII-gelingli/echem-agent/resolve/main/Dockerfile
- Command line
-
hf download hf://spaces/SII-gelingli/echem-agent/Dockerfile
-
curl -L -o Dockerfile https://huggingface.co/spaces/SII-gelingli/echem-agent/resolve/main/Dockerfile
1.57 kB
| # Hugging Face Spaces Dockerfile | |
| FROM python:3.11-slim | |
| WORKDIR /app | |
| # Install system dependencies | |
| RUN apt-get update && apt-get install -y --no-install-recommends \ | |
| libxrender1 libxext6 \ | |
| nodejs npm \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Install Python dependencies | |
| COPY backend/requirements.txt . | |
| RUN pip install --no-cache-dir torch --index-url https://download.pytorch.org/whl/cpu \ | |
| && pip install --no-cache-dir -r requirements.txt | |
| # Build frontend | |
| COPY frontend /frontend | |
| WORKDIR /frontend | |
| RUN npm install && npm run build | |
| # Copy backend | |
| WORKDIR /app | |
| COPY backend/app ./app | |
| COPY backend/alembic ./alembic | |
| COPY backend/alembic.ini . | |
| # Copy frontend build to expected location | |
| RUN mkdir -p /app/frontend && cp -r /frontend/dist /app/frontend/ | |
| # Copy ML data and checkpoints | |
| COPY backend/app/ml/data ./app/ml/data | |
| COPY backend/app/ml/yield_prediction/checkpoints ./app/ml/yield_prediction/checkpoints | |
| COPY backend/app/ml/yield_prediction/data ./app/ml/yield_prediction/data | |
| # Create startup script | |
| RUN echo '#!/bin/bash\n\ | |
| cd /app\n\ | |
| python -c "from app.core.database import engine, Base; import asyncio; asyncio.run(engine.begin())" 2>/dev/null || true\n\ | |
| alembic upgrade head 2>/dev/null || true\n\ | |
| uvicorn app.main:app --host 0.0.0.0 --port 7860 --workers 1\n\ | |
| ' > /app/start.sh && chmod +x /app/start.sh | |
| # HF Spaces uses port 7860 | |
| EXPOSE 7860 | |
| # Set environment defaults | |
| ENV DATABASE_URL=sqlite+aiosqlite:///./data/echem_agent.db | |
| ENV DEVICE=cpu | |
| ENV CORS_ORIGINS=* | |
| # Create data directory for SQLite | |
| RUN mkdir -p /app/data | |
| CMD ["/app/start.sh"] | |