Spaces:
Sleeping
Sleeping
| FROM python:3.11-slim | |
| WORKDIR /app | |
| # System deps | |
| RUN apt-get update && apt-get install -y \ | |
| git \ | |
| build-essential \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Python deps first (layer cache) | |
| COPY requirements.txt . | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # Copy all project files | |
| COPY immunoorg/ ./immunoorg/ | |
| COPY server/ ./server/ | |
| COPY visualization/ ./visualization/ | |
| COPY openenv.yaml . | |
| COPY README.md . | |
| # Create a non-root user (HF Spaces requirement) | |
| RUN useradd -m -u 1000 user | |
| USER user | |
| ENV HOME=/home/user PATH=/home/user/.local/bin:$PATH | |
| WORKDIR /home/user/app | |
| COPY --chown=user . . | |
| # Expose port | |
| EXPOSE 7860 | |
| # Health check | |
| HEALTHCHECK --interval=30s --timeout=10s --start-period=30s --retries=3 \ | |
| CMD python -c "import os,requests; p=os.environ.get('PORT','7860'); requests.get(f'http://localhost:{p}/health')" || exit 1 | |
| # Run the FastAPI server | |
| CMD ["sh", "-lc", "uvicorn server.main:app --host 0.0.0.0 --port ${PORT:-7860}"] | |