FROM python:3.12-slim ENV PYTHONUNBUFFERED=1 WORKDIR /app COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt COPY . . # Stamp the image with the git SHA so the web footer can show which commit is # live. Coolify passes SOURCE_COMMIT as a build arg on every deploy; outside # Coolify the ARG defaults to "dev". Placed after COPY so only this thin layer # rebuilds when the SHA changes — pip install stays cached. ARG SOURCE_COMMIT=dev ENV GIT_COMMIT=${SOURCE_COMMIT} EXPOSE 8000 HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \ CMD python -c "import urllib.request,sys; sys.exit(0 if urllib.request.urlopen('http://127.0.0.1:8000/health', timeout=3).status==200 else 1)" CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "8000", "--proxy-headers", "--forwarded-allow-ips", "*"]