[#100] Added Docker image with multi-arch CI build, test, and Docker Hub publish.#334
Conversation
📝 WalkthroughWalkthroughAdds Docker container support for ChangesDocker Container Support
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #334 +/- ##
=======================================
Coverage 96.91% 96.91%
=======================================
Files 6 6
Lines 421 421
=======================================
Hits 408 408
Misses 13 13 ☔ View full report in Codecov by Harness. |
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.github/workflows/test-docker.yml:
- Around line 16-17: The concurrency group on line 16 uses github.run_id as the
fallback, which is always unique for each run, preventing push events from being
grouped together. Replace the fallback value from github.run_id to github.ref so
that concurrent pushes to the same branch will share the same concurrency group
and properly cancel previous runs. This ensures that concurrent pushes to main
will cancel each other instead of racing to overwrite the canary artifact.
In `@Dockerfile`:
- Line 49: The RUN git config command uses a wildcard '*' for safe.directory,
which disables Git's ownership protection for all repositories in the container,
creating a security vulnerability. Replace the wildcard '*' with the specific
mount path(s) that your application expects to use, such as the exact directory
path where Git repositories will be mounted or accessed, ensuring that only
those specific trusted directories bypass Git's ownership verification checks.
In `@README.md`:
- Around line 182-189: In the docker run command shown in the README.md example,
replace the SSH remote URL (git@github.com:yourorg/your-repo-destination.git)
with an HTTPS equivalent (https://github.com/yourorg/your-repo-destination.git)
since SSH credentials are not mounted in the Docker container and the command
will fail as written. Keep the SSH remote format only in the second example that
follows this one.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: a2791e1c-d13f-4e0a-ae44-5ef0a5bb07d3
📒 Files selected for processing (5)
.dockerignore.github/workflows/release-docker.yml.github/workflows/test-docker.ymlDockerfileREADME.md
…ncurrency grouping, used HTTPS in the basic Docker example.
Closes #100
Summary
Adds a multi-architecture Docker image for
git-artifactso the tool can be used without a local PHP installation. The image is built in a multi-stageDockerfile, tested end-to-end in CI on every PR and push tomain, published asdrevops/git-artifact:canaryonmainpushes, and released to Docker Hub as versioned tags (pluslatest) on git tag pushes.Changes
Dockerfile- Multi-stage build: abuilderstage based onphp:8.5-cli(digest-pinned) installs Composer and runscomposer buildto produce the Box PHAR; the runtime stage copies only the PHAR, installsgitandopenssh-client, bakes ingit config --system --add safe.directory '*'to trust the host-mounted source and destination repositories, and sets the PHAR as theENTRYPOINT..dockerignore- Excludes.git,vendor,tests, and other non-essential paths from the build context to keep the image build fast and prevent the hostvendor/from leaking into the builder stage..github/workflows/test-docker.yml- Runs on PRs andmainpushes: lints theDockerfilewith hadolint, builds the image, then runs a functional test that mounts a real source repo and a bare destination repo and asserts the artifact was pushed to the destination branch. Apush-canary-to-registryjob (gated onmainpush, needs the test job) publishesdrevops/git-artifact:canaryas a multi-arch image (linux/amd64,linux/arm64). Both jobs usepersist-credentials: false, least-privilegepermissions: contents: read, and concurrency control..github/workflows/release-docker.yml- Triggers on tag pushes: multi-arch build and push to Docker Hub (drevops/git-artifact) usingdocker/build-push-actionwith tags and labels derived fromdocker/metadata-action. Authenticates viaDOCKER_USER/DOCKER_PASSrepo secrets withpersist-credentials: falseandpermissions: contents: read.README.md- Adds Test Docker, Docker Pulls, and architecture (amd64/arm64) badges, plus an "As a Docker container" installation section with HTTPS and SSH usage examples and an "Image tags" subsection documenting thecanary,latest, and versioned tags and how each is published.Before / After
Summary by CodeRabbit
git-artifact, with multi-architecture (amd64/arm64) builds and a ready-to-use entrypoint.