Professional Docker setup: pinned builds, healthcheck, dev/prod compo…#3
Merged
Conversation
…se split Dockerfile: - Add .dockerignore (no more .git/.env/.venv leaking into the image) - Pin uv image (0.11) instead of :latest, install with --locked so the build fails on a stale uv.lock - BuildKit cache mount for uv, bytecode precompilation, UV_LINK_MODE=copy - venv moved to root-owned /opt/venv: the app user cannot modify its own dependencies - Non-root user with nologin shell, app dir prepared via install -d - Image-level HEALTHCHECK probing /health/ (no curl dependency) - OCI image labels, dedicated production target with code baked in Compose: - Split into docker-compose.yml (shared base), docker-compose.override.yml (dev: source bind-mount, DB ports on localhost only) and docker-compose.prod.yml (production target, resource limits, DB ports unpublished) - json-file log rotation on all services, init: true for django - Drop unused uv_cache/logs/www mounts and MODE variable Settings: - prod: allow 127.0.0.1 host and exempt /health/ from SSL redirect so the container healthcheck works behind TLS-terminating proxies Tooling: make up-prod/down-prod/logs-prod, README Docker section, ignore staticfiles/ in git https://claude.ai/code/session_01YZr4TbzTw6EkkFqZz2onTF
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
…se split
Dockerfile:
Compose:
Settings:
Tooling: make up-prod/down-prod/logs-prod, README Docker section, ignore staticfiles/ in git