inbox-zero icon indicating copy to clipboard operation
inbox-zero copied to clipboard

Feature: Enable Docker image creation

Open gowthamkishore3799 opened this issue 6 months ago • 5 comments
trafficstars

Description

Enables automatic creation and publishing of a Docker image whenever a push is made to the main branch.

Solution

  • Updates docker-compose.yml to explicitly configure image pulling.
  • Adds a build_apps.yml GitHub Actions workflow to build and tag Docker images for every release.
  • Pushes built images to GitHub Container Registry (GHCR) under ghcr.io.
  • Docker setup now correctly uses only the apps/web/.env file for configuration through the env_file directive.

Note for Maintainers

After merging this PR, the repository owner must add a PASSWORD secret in the repository settings to allow pushing images to GHCR:

  1. Go to Profile → Settings → Developer Settings → Personal Access Tokens (Classic).
  2. Create a token with the write:packages permission.
  3. Add the token as a secret named PASSWORD in the repository.

Without this, the image push will fail.

  • Users can pull the latest image using:
docker pull ghcr.io/elie222/inbox-zero:latest

Summary by CodeRabbit

  • Chores
    • Added an automated workflow to build and publish Docker images for the app on updates to the main branch.
    • Updated the test workflow to display a custom name in the GitHub Actions UI.
    • Modified Docker Compose to always pull the latest web image from the GitHub Container Registry.

gowthamkishore3799 avatar Apr 26 '25 06:04 gowthamkishore3799

@gowthamkishore3799 is attempting to deploy a commit to the Inbox Zero Team on Vercel.

A member of the Team first needs to authorize it.

vercel[bot] avatar Apr 26 '25 06:04 vercel[bot]

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
1 out of 2 committers have signed the CLA.

:white_check_mark: gowthamkishore3799
:x: github-actions[bot]
You have signed the CLA already but the status is still pending? Let us recheck it.

CLAassistant avatar Apr 26 '25 06:04 CLAassistant

Walkthrough

A 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

File(s) Change Summary
.github/workflows/build_apps.yml Added a new workflow to automate version tagging and Docker image building/publishing on main branch pushes.
.github/workflows/test.yml Added a run-name attribute to set the workflow display name to "Run Tests".
docker-compose.yml Updated web service to specify the image as ghcr.io/elie222/inbox-zero:latest and set pull_policy to always.

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

A workflow hops in, swift and bright,
Tagging versions, setting them right.
Docker images built with care,
For every branch push, they're always there.
Compose now pulls from the registry's den—
Hooray for automation, again and again!
🐇✨


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.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need 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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

coderabbitai[bot] avatar Apr 26 '25 06:04 coderabbitai[bot]

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? https://github.com/elie222/inbox-zero/pull/418

elie222 avatar Apr 29 '25 19:04 elie222

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:

Container Package

Workflow Run

Whenever I push a change to the trial branch, an image is automatically created. Similarly, when a PR is merged into main, a new image will be built.

Users just need to set the required environment variables and run docker-compose up to get started.

gowthamkishore3799 avatar Apr 29 '25 19:04 gowthamkishore3799

@gowthamkishore3799 could you sign the CLA please

elie222 avatar May 04 '25 14:05 elie222

Done signed it, but since #418 is merged, we can skip this

gowthamkishore3799 avatar May 04 '25 15:05 gowthamkishore3799

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!

elie222 avatar May 04 '25 15:05 elie222

Sure,appreciate that,

gowthamkishore3799 avatar May 04 '25 15:05 gowthamkishore3799