The .git-COPY approach froma35e6c9never actually deployed: BuildKit rejected `COPY .git /tmp/.git` with "failed to calculate checks" because Coolify's build context doesn't include .git, so deploy 86 failed and the stale0144cb2image kept serving "build dev" in the footer. Coolify v4 already injects SOURCE_COMMIT into the container env at runtime by default (build-time only on opt-in, since it busts the build cache by definition). Map SOURCE_COMMIT → GIT_COMMIT in docker-compose, drop the build-time SHA stamping (and the repo-root build context that only existed to reach .git), and shrink _read_git_commit to a one-liner getenv. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
18 lines
576 B
Docker
18 lines
576 B
Docker
FROM python:3.12-slim
|
|
|
|
ENV PYTHONUNBUFFERED=1
|
|
WORKDIR /app
|
|
|
|
# Deps first so a code-only change doesn't bust the pip-install cache.
|
|
COPY requirements.txt .
|
|
RUN pip install --no-cache-dir -r requirements.txt
|
|
|
|
# App code.
|
|
COPY . .
|
|
|
|
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", "*"]
|