# Minimal compliant Dockerfile for a Python app deployed to this Coolify instance. # # Hard rules followed (see docs/AGENTS-coolify-apps.md): # - No published host ports 80/443 (Traefik routes them). # - Real listening port is set via ports_exposes in Coolify (here 8080). # - Healthcheck endpoint must NOT depend on the DB being reachable at boot. FROM python:3.12-slim AS build WORKDIR /app ENV PIP_NO_CACHE_DIR=1 COPY requirements.txt . RUN pip install --prefix=/install -r requirements.txt FROM python:3.12-slim AS run WORKDIR /app ENV PYTHONUNBUFFERED=1 ENV PORT=8080 COPY --from=build /install /usr/local COPY . . HEALTHCHECK --interval=30s --timeout=5s --retries=3 --start-period=20s \ CMD python -c "import urllib.request,sys; urllib.request.urlopen('http://localhost:8080/health'); sys.exit(0)" || exit 1 EXPOSE 8080 # Adjust to your framework: gunicorn, uvicorn, fastapi, etc. CMD ["gunicorn", "-b", "0.0.0.0:8080", "app:app"]