Skip to content

Add Docker image build workflow - #3

Merged
keito4 merged 1 commit into
masterfrom
codex/共通コンポーネントを作成
May 21, 2025

Hidden character warning

The head ref may contain hidden characters: "codex/\u5171\u901a\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u3092\u4f5c\u6210"
Merged

Add Docker image build workflow#3
keito4 merged 1 commit into
masterfrom
codex/共通コンポーネントを作成

Conversation

@keito4

@keito4 keito4 commented May 21, 2025

Copy link
Copy Markdown
Owner

Summary

  • build Dockerfile and publish to GHCR via GitHub Actions
  • mention the automatic Docker image build in README

Testing

  • bash -n features/common/install.sh
  • jq . .devcontainer/devcontainer.json
  • jq . features/common/devcontainer-feature.json

Summary by CodeRabbit

  • New Features

    • Introduced a reusable devcontainer configuration for streamlined development environment setup.
    • Added a configurable devcontainer feature for applying common settings automatically.
    • Enabled automated building and publishing of Docker images to the GitHub Container Registry via GitHub Actions.
  • Documentation

    • Added and updated README files with instructions for using the devcontainer setup and details about the new automation workflows.

@cubic-dev-ai

cubic-dev-ai Bot commented May 21, 2025

Copy link
Copy Markdown

Your cubic subscription is currently inactive. Please reactivate your subscription to receive AI reviews and use cubic.

@coderabbitai

coderabbitai Bot commented May 21, 2025

Copy link
Copy Markdown

Walkthrough

This update introduces a reusable devcontainer setup, including configuration files, feature metadata, and automation scripts to streamline development environment provisioning. Documentation is added to explain usage, and a GitHub Actions workflow is established to build and publish a Docker image to the GitHub Container Registry.

Changes

File(s) Change Summary
.devcontainer/README.md, README.md Added and updated documentation describing reusable devcontainer configuration, usage instructions, and Docker image build process.
.devcontainer/devcontainer.json Introduced a devcontainer configuration using a base Ubuntu image and referencing a local feature for common setup.
.github/workflows/docker-image.yml Added a GitHub Actions workflow to build and publish a Docker image on pushes and manual triggers.
features/common/devcontainer-feature.json Created feature metadata for a "Config Base" devcontainer feature, specifying ID, version, and description.
features/common/install.sh Added an install script that runs a repository import script if present, to automate configuration during container setup.

Sequence Diagram(s)

sequenceDiagram
    participant Developer
    participant VSCode/Devcontainer
    participant FeatureInstallScript
    participant RepoImportScript

    Developer->>VSCode/Devcontainer: Start devcontainer
    VSCode/Devcontainer->>FeatureInstallScript: Run features/common/install.sh
    FeatureInstallScript->>RepoImportScript: Execute script/import.sh (if exists)
    RepoImportScript-->>FeatureInstallScript: Apply repository configuration
    FeatureInstallScript-->>VSCode/Devcontainer: Feature setup complete
    VSCode/Devcontainer-->>Developer: Devcontainer ready with applied settings
Loading
sequenceDiagram
    participant GitHub
    participant GitHub Actions
    participant Docker Buildx
    participant GHCR

    GitHub->>GitHub Actions: Push to main or manual trigger
    GitHub Actions->>Docker Buildx: Build Docker image (./docker/Dockerfile)
    Docker Buildx->>GHCR: Push image (ghcr.io/<repo>/config-base:latest)
    GHCR-->>GitHub Actions: Image published
Loading

Poem

🐇
In the warren of code, a new home appears,
With scripts and configs to calm all our fears.
Containers now build with a magical touch,
And GitHub’s own Actions accomplish so much!
Hop in, set up, let the features cascade—
The devcontainer’s ready, the groundwork is laid.
🥕

Note

⚡️ AI Code Reviews for VS Code, Cursor, Windsurf

CodeRabbit now has a plugin for VS Code, Cursor and Windsurf. This brings AI code reviews directly in the code editor. Each commit is reviewed immediately, finding bugs before the PR is raised. Seamless context handoff to your AI code agent ensures that you can easily incorporate review feedback.
Learn more here.


Note

⚡️ Faster reviews with caching

CodeRabbit now supports caching for code and dependencies, helping speed up reviews. This means quicker feedback, reduced wait times, and a smoother review experience overall. Cached data is encrypted and stored securely. This feature will be automatically enabled for all accounts on May 16th. To opt out, configure Review - Disable Cache at either the organization or repository level. If you prefer to disable all data retention across your organization, simply turn off the Data Retention setting under your Organization Settings.
Enjoy the performance boost—your workflow just got faster.

✨ Finishing Touches
  • 📝 Generate Docstrings

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.
    • Explain this complex logic.
    • 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 explain this code block.
    • @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 explain its main purpose.
    • @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.

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Summary

This PR introduces a reusable devcontainer configuration and Docker image build workflow, enabling standardized development environments across projects with automated container image publishing to GitHub Container Registry.

  • New workflow .github/workflows/docker-image.yml triggers on main branch but is configured for 'master', which may prevent automated builds
  • .devcontainer/devcontainer.json establishes base configuration using Microsoft's Ubuntu image with custom features
  • features/common/install.sh assumes /bin/zsh availability which could fail in minimal containers
  • Added comprehensive Japanese documentation in .devcontainer/README.md explaining component reuse
  • New features/common/devcontainer-feature.json defines base configuration with version 0.1.0

6 file(s) reviewed, 3 comment(s)
Edit PR Review Bot Settings | Greptile

"name": "Config Base Container",
"image": "mcr.microsoft.com/devcontainers/base:ubuntu",
"features": {
"../features/common": {}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: Consider using an absolute path or repository reference instead of a relative path to ensure the feature can be referenced correctly from other repositories

context: ./docker
file: ./docker/Dockerfile
push: true
tags: ghcr.io/${{ github.repository }}/config-base:latest

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: Consider adding version tags in addition to 'latest' for better image versioning

set -e
REPO_ROOT="$(cd "$(dirname "$0")/../.." && pwd)"
if [ -f "$REPO_ROOT/script/import.sh" ]; then
/bin/zsh "$REPO_ROOT/script/import.sh"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logic: Hardcoding /bin/zsh could fail if zsh isn't installed. Consider using $SHELL or defaulting to /bin/sh

Suggested change
/bin/zsh "$REPO_ROOT/script/import.sh"
"${SHELL:-/bin/sh}" "$REPO_ROOT/script/import.sh"

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (8)
features/common/install.sh (3)

1-2: Enhance script robustness with stricter shell options
Consider adding set -u (treat unset variables as errors) and set -o pipefail to catch more failure modes.

Example diff:

 #!/bin/sh
 set -e
+set -u
+set -o pipefail

3-3: Simplify path resolution using realpath
Using realpath can make the intent clearer and handle edge cases.

Example diff:

-REPO_ROOT="$(cd "$(dirname "$0")/../.." && pwd)"
+REPO_ROOT="$(realpath "$(dirname "$0")/../..")"

4-6: Provide fallback if zsh is unavailable
Hardcoding /bin/zsh may fail if zsh isn't installed. Check for a compatible shell or fallback to sh.

Example diff:

-if [ -f "$REPO_ROOT/script/import.sh" ]; then
-  /bin/zsh "$REPO_ROOT/script/import.sh"
-fi
+if [ -f "$REPO_ROOT/script/import.sh" ]; then
+  if command -v zsh >/dev/null 2>&1; then
+    zsh "$REPO_ROOT/script/import.sh"
+  else
+    sh "$REPO_ROOT/script/import.sh"
+  fi
+fi
.devcontainer/devcontainer.json (1)

2-3: Consider using the published GHCR image
To leverage the workflow's output, update the image field to the built image tag, e.g.:

"image": "ghcr.io/${{ github.repository_owner }}/${{ github.repository_name }}/config-base:latest"

This ensures your devcontainer uses the pre-built environment.

README.md (2)

13-14: Clarify registry and code formatting
Wrap key paths and registry names in backticks, and mention GHCR explicitly.

Example diff:

-- `.devcontainer`: Provides a reusable devcontainer configuration and feature for applying these settings automatically.
-- GitHub Actions builds the `docker/Dockerfile` and publishes the image to GitHub Container Registry.
+- `.devcontainer`: Provides a reusable devcontainer configuration and feature for applying these settings automatically.
+- GitHub Actions builds the `docker/Dockerfile` and publishes the image to `GitHub Container Registry (GHCR)` under `ghcr.io/<owner>/<repo>/config-base:latest`.
🧰 Tools
🪛 LanguageTool

[uncategorized] ~13-~13: Loose punctuation mark.
Context: ...ent tools and systems. - .devcontainer: Provides a reusable devcontainer config...

(UNLIKELY_OPENING_PUNCTUATION)


41-44: Align heading level for Devcontainer section
Use ## Devcontainer to match other top-level sections or ensure it nests under Usage intentionally.

Example diff:

-### Devcontainer
+## Devcontainer
.devcontainer/README.md (1)

1-17: Consider adding a link to the main README
Providing a link back to the root README gives users context for the overall repo purpose.

Example diff:

 # 共通 devcontainer コンポーネント
+
+> 詳細はルートの [README.md](../README.md) を参照してください。
.github/workflows/docker-image.yml (1)

18-26: Consider Updating actions/checkout to v4
While actions/checkout@v3 works well today, v4 is available and includes performance improvements and new features. You can optionally bump this to lock in the latest enhancements:

- uses: actions/checkout@v3
+ uses: actions/checkout@v4
🧰 Tools
🪛 actionlint (1.7.7)

18-18: the runner of "actions/checkout@v3" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)


19-19: the runner of "docker/setup-qemu-action@v2" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)


20-20: 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)


22-22: the runner of "docker/login-action@v2" 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
Cache: Disabled due to data retention organization setting
Knowledge Base: Disabled due to data retention organization setting

📥 Commits

Reviewing files that changed from the base of the PR and between 9213a06 and 831ba5f.

📒 Files selected for processing (6)
  • .devcontainer/README.md (1 hunks)
  • .devcontainer/devcontainer.json (1 hunks)
  • .github/workflows/docker-image.yml (1 hunks)
  • README.md (2 hunks)
  • features/common/devcontainer-feature.json (1 hunks)
  • features/common/install.sh (1 hunks)
🧰 Additional context used
🪛 LanguageTool
README.md

[uncategorized] ~13-~13: Loose punctuation mark.
Context: ...ent tools and systems. - .devcontainer: Provides a reusable devcontainer config...

(UNLIKELY_OPENING_PUNCTUATION)

🪛 actionlint (1.7.7)
.github/workflows/docker-image.yml

18-18: the runner of "actions/checkout@v3" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)


19-19: the runner of "docker/setup-qemu-action@v2" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)


20-20: 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)


22-22: the runner of "docker/login-action@v2" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)

🔇 Additional comments (6)
.devcontainer/devcontainer.json (1)

4-6: Local feature reference looks correct
Your feature inclusion via a relative path is valid and aligns with the devcontainer spec.

features/common/devcontainer-feature.json (1)

1-6: Feature metadata is valid
The id, version, name, and description fields align with devcontainer feature requirements.

.github/workflows/docker-image.yml (4)

1-2: Workflow Naming and Purpose Looks Good
The workflow name is clear and descriptive, accurately reflecting its function for building and releasing the Docker image.


3-10: Trigger Configuration is Appropriate
Using push on main for changes under docker/** (and the workflow file itself) alongside workflow_dispatch covers your CI/CD needs without adding unnecessary events.


11-17: Job Permissions are Correctly Scoped
Granting contents: read and packages: write follows the principle of least privilege while allowing image publishing to GHCR.


27-34: Build and Push Steps are Correct
The QEMU setup, Buildx configuration, login step, and docker/build-push-action@v5 invocation are correctly defined, ensuring multi-platform builds and pushing the config-base:latest image to GHCR.

@keito4
keito4 merged commit dfff0fa into master May 21, 2025
@keito4
keito4 deleted the codex/共通コンポーネントを作成 branch January 4, 2026 08:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant