FROM python:3.11-slim ENV PYTHONUNBUFFERED=1 \ PYTHONDONTWRITEBYTECODE=1 \ PIP_NO_CACHE_DIR=1 RUN apt-get update && apt-get install -y --no-install-recommends \ gcc \ git \ && rm -rf /var/lib/apt/lists/* WORKDIR /app COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt COPY api_server.py airports.py cache.py scan_processor.py searcher_v3.py ./ COPY database/ ./database/ # Pre-fetch airport data and initialise the database at build time RUN mkdir -p data && \ python -c "from airports import download_and_build_airport_data; download_and_build_airport_data()" && \ python database/init_db.py EXPOSE 8000 HEALTHCHECK --interval=30s --timeout=5s --start-period=15s --retries=3 \ CMD python -c "import urllib.request; urllib.request.urlopen('http://localhost:8000/health')" || exit 1 CMD ["python", "api_server.py"]