Spaces:
Sleeping
Sleeping
| # Hospital ED — OpenEnv FastAPI server Dockerfile. | |
| # | |
| # Build: docker build -f server/Dockerfile -t hospital-ed-env . | |
| # Run: docker run --rm -p 8000:8000 hospital-ed-env | |
| # | |
| # The image installs the repo-level requirements and launches | |
| # `uvicorn server.app:app` on port 8000. This is the exact contract the | |
| # OpenEnv framework and the hackathon grader expect. | |
| FROM python:3.11-slim | |
| WORKDIR /app | |
| # System build tools (some scientific wheels need gcc) | |
| RUN apt-get update && apt-get install -y --no-install-recommends \ | |
| build-essential curl \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Copy the server-specific requirements first for better layer caching | |
| COPY server/requirements.txt /tmp/server-requirements.txt | |
| RUN pip install --no-cache-dir -r /tmp/server-requirements.txt | |
| # Copy the full project into /app. PYTHONPATH includes /app so | |
| # `from hospital_env import ...`, `from server.app import ...`, etc. resolve. | |
| COPY . /app | |
| ENV PYTHONUNBUFFERED=1 | |
| ENV PYTHONPATH=/app | |
| EXPOSE 8000 | |
| # OpenEnv framework expects a health endpoint on / (the FastAPI app | |
| # provides /health). Wire it up so orchestrators can detect readiness. | |
| HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \ | |
| CMD curl -fsS http://localhost:8000/health || exit 1 | |
| # Run the OpenEnv FastAPI app on port 8000. | |
| CMD ["uvicorn", "server.app:app", "--host", "0.0.0.0", "--port", "8000"] | |