| FROM python:3.11-slim | |
| RUN useradd -m -u 1000 appuser | |
| WORKDIR /app | |
| COPY requirements.txt . | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| COPY server.py scenario_generator.py inference.py app.py \ | |
| openenv.yaml README.md pytest.ini ./ | |
| COPY tests/ ./tests/ | |
| RUN chown -R appuser:appuser /app | |
| USER appuser | |
| EXPOSE 7860 | |
| HEALTHCHECK --interval=15s --timeout=10s --start-period=40s --retries=3 \ | |
| CMD python -c "import urllib.request; urllib.request.urlopen('http://localhost:7860/health')" | |
| # FIX: "python server.py" runs via __main__ which calls demo.launch() — that | |
| # starts Gradio alone without the FastAPI routes, so /reset /step /state 404. | |
| # Run uvicorn directly on server:app so the fully-mounted app (Gradio + FastAPI) | |
| # is served correctly on port 7860. | |
| CMD ["uvicorn", "server:app", "--host", "0.0.0.0", "--port", "7860"] | |