Files
OSIT-AE-API-FastAPI/Dockerfile
Scott Idem 32560d2257 feat: Operational hardening — healthcheck, config refactor, requirements lock
- Add GET /health route (DB + Redis ping, 200/503) with Dockerfile HEALTHCHECK directive
- Replace config.py stub with real pydantic BaseSettings reading directly from env vars;
  remove external config file mount from docker-compose
- Add requirements.lock (pip freeze snapshot for bit-identical builds)
- Untrack config.py globally but allow app/config.py via .gitignore negation

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-10 18:44:58 -04:00

32 lines
1.1 KiB
Docker

# Aether API - FastAPI + Gunicorn
# Using tiangolo's optimized FastAPI image
FROM tiangolo/uvicorn-gunicorn-fastapi:python3.11
LABEL maintainer="Scott Idem <scott.idem@oneskyit.com>"
WORKDIR /srv/aether_api
# Install OS dependencies for image processing and utilities
RUN apt-get update; \
apt-get install -y \
imagemagick ffmpeg curl poppler-utils \
; \
rm -rf /var/lib/apt/lists/*;
# Install Python requirements
# This file is now located in the project root
COPY requirements.txt /tmp/requirements.txt
RUN pip install --no-cache-dir -r /tmp/requirements.txt
# Create a reference of actual installed versions
RUN pip freeze >> /tmp/aether_fastapi_requirements_current.txt
# Docker health check — verifies DB + Redis connectivity via the /health route.
# Interval/timeout tuned for Gunicorn startup time.
HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \
CMD curl -f http://localhost/health || exit 1
# The application source is mounted as a volume in docker-compose.yml
# for real-time development, but we set the default command here.
CMD ["gunicorn", "--conf", "/conf/gunicorn_fastapi_conf.py"]