Skip to content

Conversation

@TkymHrt
Copy link
Member

@TkymHrt TkymHrt commented Jan 12, 2026

対応Issue

https://nut-m-e-g.slack.com/archives/C020WQ3GY07/p1768051810911529

概要

開発開始までのビルド時間の短縮、および本番環境との整合性を高めるためにDocker環境の最適化をしました。

主な変更点

  • 開発環境の軽量化: ベースイメージをAlpine版に変更 (golang:1.25.5-alpine, node:24-alpine)
  • 権限問題の解消: コンテナ内のユーザーをホストユーザー(UID 1000)と一致させることで、生成ファイルがroot権限になる問題を解決
  • ビルド高速化: pnpm-storego-cache を名前付きボリュームで永続化し、キャッシュを有効活用
  • 構成のシンプル化: api/start.sh を廃止し、Airを直接起動するように変更
  • 本番環境の更新: 本番用Dockerイメージも最新のDistroless (Debian 13) ベースに更新
  • ローカル検証環境の修正: make build-stg, make run-prod が正常に動作するように修正

画面スクリーンショット等

  • N/A

テスト項目

  • make build -> make run で開発環境が起動し、API/Viewが正常に動作すること
  • コンテナ内で生成されたファイル(api/tmpview/.next 等)の所有者がホストユーザーになっていること
  • pnpm installgo build が2回目以降高速化されていること(キャッシュ確認)
  • make build-stg が成功すること
  • docker compose -f compose.prod.yml build が成功すること
  • docker compose -f compose.local-prod.yml build が成功すること

備考

ビルド時のネットワーク問題でフォントが引っかかるので、ローカルフォントに変更しました。

@gemini-code-assist
Copy link

Summary of Changes

Hello @TkymHrt, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

このプルリクエストは、開発環境のセットアップ時間を短縮し、本番環境との整合性を高めるためにDocker環境を最適化することを目的としています。軽量なベースイメージの採用、キャッシュの永続化、コンテナ内のユーザー権限の調整、およびビルドプロセスの簡素化を通じて、開発体験とデプロイの信頼性を向上させます。また、本番環境のイメージも最新化され、ローカルでの検証プロセスも改善されています。

Highlights

  • 開発環境の軽量化: GoとNode.jsの開発環境のベースイメージをAlpine版(golang:1.25.5-alpine, node:24-alpine)に変更し、コンテナサイズを削減しました。
  • 権限問題の解消: コンテナ内のユーザーをホストユーザー(UID 1000)と一致させることで、コンテナ内で生成されるファイルの所有権がrootになる問題を解決しました。
  • ビルド高速化: pnpm-storego-cachego-mod-cacheを名前付きボリュームで永続化し、キャッシュを有効活用することでビルド時間を短縮しました。
  • 構成のシンプル化: api/start.shスクリプトを廃止し、APIコンテナが直接Airを起動するように変更しました。
  • 本番環境の更新: 本番用Dockerイメージのベースを最新のDistroless(Debian 13)に更新しました。
  • ローカル検証環境の修正: make build-stgおよびmake run-prodコマンドが正常に動作するように修正しました。
  • フォント問題の解消: ビルド時のネットワーク問題でフォントが引っかかる問題を解決するため、Next.jsアプリケーションでローカルフォントを使用するように変更しました。
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@TkymHrt TkymHrt changed the title Refactor/optimize docker Docker環境の最適化 Jan 12, 2026
Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

このプルリクエストは、Docker環境を最適化し、開発ビルドの高速化と本番環境との整合性向上を目指すもので、全体として素晴らしい改善だと感じました。

主な変更点として、軽量なalpineイメージの採用、非rootユーザーでのコンテナ実行による権限問題の解消、名前付きボリュームを利用したキャッシュによるビルド高速化など、多くのベストプラクティスが取り入れられています。特に、開発体験の向上に大きく寄与する変更だと思います。

コード全体を確認し、更なる改善のための提案をいくつかコメントしました。特に、本番用APIイメージのビルドキャッシュ効率化に関する提案は、ビルド時間の短縮に繋がるため、ご確認いただけると幸いです。

素晴らしいお仕事です!

@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Jan 12, 2026

Deploying finansu with  Cloudflare Pages  Cloudflare Pages

Latest commit: 2b6dceb
Status: ✅  Deploy successful!
Preview URL: https://80503466.finansu.pages.dev
Branch Preview URL: https://refactor-optimize-docker.finansu.pages.dev

View logs

@TkymHrt TkymHrt requested review from Kubosaka and hikahana January 12, 2026 11:44
Copy link
Collaborator

Choose a reason for hiding this comment

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

ビルド時のネットワーク問題でフォントが引っかかるので、ローカルフォントに変更しました。

prdでbuildにめっちゃ時間かかる問題とか解決したりするのかな

Copy link
Member Author

Choose a reason for hiding this comment

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

フォント関係でタイムアウト待ちしなくなるので、改善されているかもです!

@TkymHrt TkymHrt requested a review from Kubosaka January 12, 2026 12:48
Copy link
Collaborator

@Kubosaka Kubosaka left a comment

Choose a reason for hiding this comment

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

対応ありがとう!

@TkymHrt TkymHrt merged commit 2a6f2ee into develop Jan 12, 2026
4 checks passed
@TkymHrt TkymHrt deleted the refactor/optimize-docker branch January 12, 2026 13:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants