| # Plant DNA Designer — container image for the FastAPI web app. | |
| # Doubles as the Hugging Face Space image (sdk: docker, app_port: 7860). | |
| # | |
| # docker build -t plant-dna-designer . | |
| # docker run -p 7860:7860 plant-dna-designer # open http://localhost:7860 | |
| # | |
| FROM python:3.12-slim | |
| ENV PIP_NO_CACHE_DIR=1 \ | |
| PYTHONUNBUFFERED=1 \ | |
| PYTHONDONTWRITEBYTECODE=1 | |
| WORKDIR /app | |
| # Core runtime dependencies (must install cleanly; all ship manylinux wheels for | |
| # cp312, so no compiler is needed). matplotlib/pytest/httpx from requirements.txt | |
| # are build/test-only and are intentionally excluded from the runtime image. | |
| RUN pip install \ | |
| "fastapi>=0.139.0" \ | |
| "uvicorn[standard]>=0.50.2" \ | |
| "jinja2>=3.1.6" \ | |
| "pydantic>=2.13.4" \ | |
| "biopython>=1.87" \ | |
| "numpy>=2.5.0" | |
| # Optional: ViennaRNA gives exact MFE / partition-function folding. The app falls | |
| # back to a built-in Nussinov estimator when it is absent, so a failure here must | |
| # NOT break the image — hence the guard. | |
| RUN pip install "ViennaRNA>=2.7.2" \ | |
| || echo "ViennaRNA unavailable; falling back to the built-in Nussinov fold." | |
| # Application code (pure-Python core, API, and no-build web frontend). | |
| COPY cool/ ./cool/ | |
| WORKDIR /app/cool | |
| EXPOSE 7860 | |
| CMD ["python", "-m", "uvicorn", "api.main:app", "--host", "0.0.0.0", "--port", "7860"] | |