Feature: Enable Docker image creation#417
Feature: Enable Docker image creation#417gowthamkishore3799 wants to merge 0 commit intoelie222:mainfrom
Conversation
|
@gowthamkishore3799 is attempting to deploy a commit to the Inbox Zero Team on Vercel. A member of the Team first needs to authorize it. |
WalkthroughA new GitHub Actions workflow was introduced to automate version tagging and multi-architecture Docker image building and publishing for the project when changes are pushed to the main branch. The workflow consists of two jobs: one for setting and incrementing the version tag, and another for building and pushing the Docker image to GitHub Container Registry. Additionally, the test workflow was updated to include a custom run name, and the Docker Compose configuration for the web service was modified to specify the image source and pull policy. Changes
Sequence Diagram(s)sequenceDiagram
participant GitHub as GitHub Actions
participant Repo as Repository
participant GHCR as GitHub Container Registry
GitHub->>Repo: On push to main
GitHub->>GitHub: set-version job
GitHub->>Repo: Checkout code
GitHub->>Repo: Get latest tag
GitHub->>Repo: Create/increment version tag
GitHub->>Repo: Push new tag
GitHub->>GitHub: build-frontend job (after set-version)
GitHub->>Repo: Checkout code
GitHub->>GHCR: Login to registry
GitHub->>GitHub: Setup Docker Buildx
GitHub->>GHCR: Build and push multi-arch Docker image (latest & version tag)
Poem
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (2)
.github/workflows/build_apps.yml (1)
34-34: Remove trailing whitespace
The blank line afterecho "tag=$TAG" >> $GITHUB_OUTPUTcontains trailing spaces; trimming them will satisfy YAML linting.🧰 Tools
🪛 YAMLlint (1.35.1)
[error] 34-34: trailing spaces
(trailing-spaces)
docker-compose.yml (1)
41-45: Reevaluateimage+buildcombination
When bothimageandbuildare specified, Compose will build the local image (tagged asghcr.io/...:latest) and skip pulling, renderingpull_policyineffective. If the goal is to always pull the published image, consider removing thebuildblock or moving it into a separatedocker-compose.override.yml. For example:web: - image: ghcr.io/elie222/inbox-zero:latest - pull_policy: always - build: - context: . - dockerfile: ./docker/Dockerfile.web + image: ghcr.io/elie222/inbox-zero:latest + pull_policy: always # build: # context: . # dockerfile: ./docker/Dockerfile.web
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
.github/workflows/build_apps.yml(1 hunks).github/workflows/test.yml(1 hunks)docker-compose.yml(1 hunks)package.json(1 hunks)
🧰 Additional context used
🪛 actionlint (1.7.4)
.github/workflows/build_apps.yml
85-85: the runner of "docker/setup-buildx-action@v2" action is too old to run on GitHub Actions. update the action's version to fix this issue
(action)
88-88: the runner of "docker/build-push-action@v4" action is too old to run on GitHub Actions. update the action's version to fix this issue
(action)
🪛 YAMLlint (1.35.1)
.github/workflows/build_apps.yml
[error] 34-34: trailing spaces
(trailing-spaces)
🔇 Additional comments (4)
.github/workflows/test.yml (1)
2-2: Approve explicitrun-nameaddition
Settingrun-name: "Run Tests"provides a clear display name for each workflow run in the UI.package.json (1)
28-30: Confirm lint-staged configuration changes
The previous formatting commands for*.{ts,tsx,md}were removed and replaced with an empty array for*.js. Ensure that TypeScript and Markdown files are still formatted/linted via your other scripts (format-and-lint,format-and-lint:fix), and update thelint-stagedsection or scripts if any file types are now unprotected..github/workflows/build_apps.yml (1)
1-2: LGTM: workflow name and run-name
The workflow’snameandrun-nameare clear and descriptive for Docker image builds.docker-compose.yml (1)
41-42: Verify Compose spec support forpull_policy
Thepull_policykey under a service was introduced in newer Compose versions. Double-check that your Docker Compose CLI and file version supportpull_policy: always, or else this field may be ignored or error out.
|
Thanks so much for this! If you could sign the CLA please! I will be looking at this PR later this week. There was also this PR, any overlap? |
|
I have signed the CLA. I only added github-actions[bot] to run GitHub Actions, which I believe doesn’t require a CLA. There was also some overlap with PR #418. I’ve been waiting for the contributor’s response in the issue discussion to figure out how we can move forward. To verify that the workflow is running, you can check: Whenever I push a change to the trial branch, an image is automatically created. Users just need to set the required environment variables and run docker-compose up to get started. |
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (3)
.github/workflows/build_apps.yml (3)
4-7: Manage concurrent builds to avoid redundant runsConsider adding concurrency control at the workflow root to cancel in-progress builds on the same ref and avoid resource waste. For example:
on: push: branches: [ "main" ] +concurrency: + group: build-image-${{ github.ref }} + cancel-in-progress: true
31-33: Remove trailing whitespaceLine 32 contains trailing spaces on an otherwise empty line. Removing them improves maintainability and prevents linter errors.
- echo "tag=$TAG" >> $GITHUB_OUTPUT -🧰 Tools
🪛 YAMLlint (1.35.1)
[error] 32-32: trailing spaces
(trailing-spaces)
85-95: Consider adding build caching to speed up Docker buildsTo improve build times and reuse layers between runs, configure
cache-fromandcache-to:- - uses: docker/build-push-action@v4 - with: - context: . - file: docker/Dockerfile.web - platforms: linux/amd64,linux/arm64 - push: true - tags: | - ghcr.io/${{ env.DOCKER_USERNAME }}/inbox-zero:latest - ghcr.io/${{ env.DOCKER_USERNAME }}/inbox-zero:${{ needs.set-version.outputs.version }} + - uses: docker/build-push-action@v4 + with: + context: . + file: docker/Dockerfile.web + platforms: linux/amd64,linux/arm64 + push: true + tags: | + ghcr.io/${{ env.DOCKER_USERNAME }}/inbox-zero:latest + ghcr.io/${{ env.DOCKER_USERNAME }}/inbox-zero:${{ needs.set-version.outputs.version }} + cache-from: type=gha + cache-to: type=gha,mode=max🧰 Tools
🪛 actionlint (1.7.4)
86-86: the runner of "docker/build-push-action@v4" action is too old to run on GitHub Actions. update the action's version to fix this issue
(action)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
.github/workflows/build_apps.yml(1 hunks)
🧰 Additional context used
🪛 actionlint (1.7.4)
.github/workflows/build_apps.yml
83-83: the runner of "docker/setup-buildx-action@v2" action is too old to run on GitHub Actions. update the action's version to fix this issue
(action)
86-86: the runner of "docker/build-push-action@v4" action is too old to run on GitHub Actions. update the action's version to fix this issue
(action)
🪛 YAMLlint (1.35.1)
.github/workflows/build_apps.yml
[error] 32-32: trailing spaces
(trailing-spaces)
.github/workflows/build_apps.yml
Outdated
| env: | ||
| DOCKER_IMAGE_REGISTRY: "ghcr.io" | ||
| DOCKER_USERNAME: "elie222" | ||
|
|
There was a problem hiding this comment.
Add explicit permissions for tag creation
Without explicit permissions in the workflow, the default GITHUB_TOKEN may lack content write access, causing the git push step in Push Git Tag to fail. Add a top-level permissions block:
env:
DOCKER_IMAGE_REGISTRY: "ghcr.io"
DOCKER_USERNAME: "elie222"
+permissions:
+ contents: write📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| env: | |
| DOCKER_IMAGE_REGISTRY: "ghcr.io" | |
| DOCKER_USERNAME: "elie222" | |
| env: | |
| DOCKER_IMAGE_REGISTRY: "ghcr.io" | |
| DOCKER_USERNAME: "elie222" | |
| permissions: | |
| contents: write |
.github/workflows/build_apps.yml
Outdated
| - name: Set up Docker Buildx | ||
| uses: docker/setup-buildx-action@v2 | ||
|
|
There was a problem hiding this comment.
💡 Verification agent
🧩 Analysis chain
Verify action versions for Docker Buildx
actionlint flagged docker/setup-buildx-action@v2 as potentially outdated. Please confirm you’re using the latest major version (e.g., v3) if available to ensure compatibility:
🌐 Web query:
What is the latest released version of `docker/setup-buildx-action` on GitHub Marketplace?
💡 Result:
Based on the search results, the latest released version of docker/setup-buildx-action on GitHub Marketplace is v3.10.0, which was released on February 26, 2025[6].
This action is designed to set up Docker Buildx in your GitHub Actions workflows. It creates and boots a builder that can be used in subsequent workflow steps when you're using Buildx or the build-push action[1][9].
The release history shows a progression of versions with v3.10.0 being the most recent, followed by previous versions including v3.9.0, v3.8.0, and v3.7.1[6]. The latest version includes updates to dependencies, specifically bumping @docker/actions-toolkit from version 0.54.0 to 0.56.0[6].
If you want to use the latest version in your workflow, you can reference it with:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3This will use the latest v3.x.x release. If you need to pin to the specific latest version, you could use:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3.10.0Citations:
- 1: https://github.com/marketplace/actions/docker-setup-buildx
- 2: https://docs.docker.com/build/ci/github-actions/configure-builder/
- 3: https://raw.githubusercontent.com/docker/setup-buildx-action/master/README.md
- 4: https://docs.docker.com/build/ci/github-actions/multi-platform/
- 5: https://git.bellacocool.com/actions/setup-buildx-action/src/commit/d0d9a7219538b0a2f1444e8ac32682583ce7ebce
- 6: https://github.com/docker/setup-buildx-action/releases
- 7: https://github.com/orgs/docker/packages/container/setup-buildx-action/295162373?tag=1.3.0
- 8: https://git.bellacocool.com/actions/setup-buildx-action/src/commit/bd58e36ac7a172323768a1c788e8987e4fd91f9c
- 9: https://github.com/docker/setup-buildx-action
- 10: https://docs.docker.com/build/ci/github-actions/cache/
Update Docker Buildx Action to v3
The workflow is currently pinning docker/setup-buildx-action@v2, but the latest v3.x release is v3.10.0 (Feb 26, 2025). Please update to the v3 major version for compatibility:
• File: .github/workflows/build_apps.yml
Lines: ~82–84
Suggested diff:
- name: Set up Docker Buildx
- uses: docker/setup-buildx-action@v2
+ name: Set up Docker Buildx
+ # use the latest v3 release; pin to v3.10.0 for reproducibility
+ uses: docker/setup-buildx-action@v3 # or @v3.10.0📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v2 | |
| - name: Set up Docker Buildx | |
| # use the latest v3 release; pin to v3.10.0 for reproducibility | |
| uses: docker/setup-buildx-action@v3 # or @v3.10.0 |
🧰 Tools
🪛 actionlint (1.7.4)
83-83: the runner of "docker/setup-buildx-action@v2" action is too old to run on GitHub Actions. update the action's version to fix this issue
(action)
|
@gowthamkishore3799 could you sign the CLA please |
|
Done signed it, but since #418 is merged, we can skip this |
Thank you in any case! Also if you want to take any of the code you had to improve the merged code I'm happy to accept it! |
|
Sure,appreciate that, |
Description
Enables automatic creation and publishing of a Docker image whenever a push is made to the
mainbranch.Solution
docker-compose.ymlto explicitly configure image pulling.build_apps.ymlGitHub Actions workflow to build and tag Docker images for every release.ghcr.io.apps/web/.envfile for configuration through theenv_filedirective.Note for Maintainers
After merging this PR, the repository owner must add a
PASSWORDsecret in the repository settings to allow pushing images to GHCR:write:packagespermission.PASSWORDin the repository.Without this, the image push will fail.
Summary by CodeRabbit