chore(docker): trim build context with .dockerignore #3

Closed
BOAScripts wants to merge 0 commits from BOAScripts/cairn:chore/dockerfile-hardening into main
First-time contributor

The build context previously carried the whole repo, including .git
(2.6 MB) and docs/ (2.2 MB of screenshots), plus any local .env.

Deny everything in .dockerignore and re-include only the build's real
inputs: go.mod, go.sum, cmd/, internal/ and web/ (the latter two cover
the go:embed trees for migrations, templates and static assets).

The Dockerfile now COPYs those paths explicitly instead of COPY . ..
Without .git in the context the git describe fallback can no longer
work, so it is dropped in favour of ARG VERSION=dev; the release
workflow already injects the tag, and README documents the
--build-arg VERSION=... form for stamped local builds.

Co-Authored-By: Claude Opus 5 (1M context) noreply@anthropic.com

The build context previously carried the whole repo, including .git (2.6 MB) and docs/ (2.2 MB of screenshots), plus any local .env. Deny everything in .dockerignore and re-include only the build's real inputs: go.mod, go.sum, cmd/, internal/ and web/ (the latter two cover the go:embed trees for migrations, templates and static assets). The Dockerfile now COPYs those paths explicitly instead of `COPY . .`. Without .git in the context the `git describe` fallback can no longer work, so it is dropped in favour of ARG VERSION=dev; the release workflow already injects the tag, and README documents the --build-arg VERSION=... form for stamped local builds. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The build context previously carried the whole repo, including .git
(2.6 MB) and docs/ (2.2 MB of screenshots), plus any local .env.

Deny everything in .dockerignore and re-include only the build's real
inputs: go.mod, go.sum, cmd/, internal/ and web/ (the latter two cover
the go:embed trees for migrations, templates and static assets).

The Dockerfile now COPYs those paths explicitly instead of `COPY . .`.
Without .git in the context the `git describe` fallback can no longer
work, so it is dropped in favour of ARG VERSION=dev; the release
workflow already injects the tag, and README documents the
--build-arg VERSION=... form for stamped local builds.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Owner

Thanks for the contribution. This PR has been integrated manually into main as commit 8e03a7e. The branch was based just before the repository migration from GitHub to Forgejo, which caused a documentation conflict in README.md. I resolved it by preserving the current Forgejo workflow and deployment references while adding the new .dockerignore documentation. The Docker changes themselves were applied unchanged, and the full Go test suite passes on the merged tree. Closing this PR as integrated.

Thanks for the contribution. This PR has been integrated manually into main as commit 8e03a7e. The branch was based just before the repository migration from GitHub to Forgejo, which caused a documentation conflict in README.md. I resolved it by preserving the current Forgejo workflow and deployment references while adding the new .dockerignore documentation. The Docker changes themselves were applied unchanged, and the full Go test suite passes on the merged tree. Closing this PR as integrated.
tweek closed this pull request 2026-08-19 21:58:26 +02:00

Pull request closed

Sign in to join this conversation.
No description provided.