Optimized by Gemini CLI... I hope.
This commit is contained in:
35
Dockerfile
35
Dockerfile
@@ -1,32 +1,35 @@
|
|||||||
# syntax=docker/dockerfile:1
|
# syntax=docker/dockerfile:1
|
||||||
# Aether API - FastAPI + Gunicorn
|
# Aether API - FastAPI + Gunicorn
|
||||||
# Using tiangolo's optimized FastAPI image
|
|
||||||
FROM tiangolo/uvicorn-gunicorn-fastapi:python3.11
|
FROM tiangolo/uvicorn-gunicorn-fastapi:python3.11
|
||||||
|
|
||||||
LABEL maintainer="Scott Idem <scott.idem@oneskyit.com>"
|
LABEL maintainer="Scott Idem <scott.idem@oneskyit.com>"
|
||||||
|
|
||||||
|
# 1. Install OS dependencies FIRST.
|
||||||
|
# These are the slowest to install and change the least.
|
||||||
|
# Doing this before WORKDIR or any COPY ensures maximum caching.
|
||||||
|
RUN apt-get update && \
|
||||||
|
apt-get install -y --no-install-recommends \
|
||||||
|
imagemagick ffmpeg curl poppler-utils && \
|
||||||
|
rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
# 2. Set the working directory
|
||||||
WORKDIR /srv/aether_api
|
WORKDIR /srv/aether_api
|
||||||
|
|
||||||
# Install OS dependencies for image processing and utilities
|
# 3. Install Python requirements
|
||||||
RUN apt-get update; \
|
# We only copy requirements.txt first to keep the pip install layer cached
|
||||||
apt-get install -y \
|
# as long as the dependencies themselves don't change.
|
||||||
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
|
COPY requirements.txt /tmp/requirements.txt
|
||||||
RUN pip install -r /tmp/requirements.txt
|
RUN pip install --no-cache-dir -r /tmp/requirements.txt
|
||||||
|
|
||||||
# Create a reference of actual installed versions
|
# 4. Create a reference of actual installed versions
|
||||||
RUN pip freeze >> /tmp/aether_fastapi_requirements_current.txt
|
RUN pip freeze > /tmp/aether_fastapi_requirements_current.txt
|
||||||
|
|
||||||
|
# NOTE: The application source is mounted as a volume in docker-compose.yml
|
||||||
|
# for real-time development. We don't COPY the source here to keep the
|
||||||
|
# image generic and the build near-instant when code changes.
|
||||||
|
|
||||||
# Docker health check — verifies DB + Redis connectivity via the /health route.
|
# 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 \
|
HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \
|
||||||
CMD curl -f http://localhost/health || exit 1
|
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"]
|
CMD ["gunicorn", "--conf", "/conf/gunicorn_fastapi_conf.py"]
|
||||||
|
|||||||
Reference in New Issue
Block a user