build command: add support for --build-arg flag

オープン
#69 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

  • #143 @OrtegaMatias による — マージされずにクローズ

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
25/100
issue の種類
機能追加
明瞭さ
明確に書かれている
活発さ
停滞
技術スタック
swift
領域
cli

調査の方向性

The issue identifies the build subcommand and the underlying container build invocation, but gives no source or test file paths. Start by locating the build command’s option parsing and existing build invocation, then check how repeated options are covered in tests. Done means each supplied --build-arg KEY=VALUE reaches every service build; an open linked pull request indicates work is already underway.

索引モデルが issue の本文から書いたものです。

説明

Summary

The build subcommand does not currently support the --build-arg flag, which is a standard part of docker compose build. Any project that relies on build-time arguments (e.g. for injecting private registry tokens or license keys into a multi-stage Dockerfile) cannot use container-compose build as a drop-in replacement today.

Current Behavior

Running the following command fails immediately with an unrecognized option error:

container-compose build \
  --build-arg BO_NPM_PKG_AUTH_TOKEN=$BO_NPM_PKG_AUTH_TOKEN \
  --build-arg FONTAWESOME_PRO_TOKEN=$FONTAWESOME_PRO_TOKEN \
  --build-arg SIDEKIQ_KEY=$SIDEKIQ_KEY
Error: Unknown option '--build-arg'
Usage: container-compose <subcommand>
  See 'container-compose --help' for more information.

Expected Behavior

Parity with docker compose build, which accepts one or more --build-arg KEY=VALUE pairs and forwards them to the underlying image build process as build-time variables. The equivalent native container build CLI also supports --build-arg, so this should be a straightforward passthrough.

# Should work the same as it does with docker compose
container-compose build \
  --build-arg BO_NPM_PKG_AUTH_TOKEN=$BO_NPM_PKG_AUTH_TOKEN \
  --build-arg FONTAWESOME_PRO_TOKEN=$FONTAWESOME_PRO_TOKEN \
  --build-arg SIDEKIQ_KEY=$SIDEKIQ_KEY

Motivation / Use Case

Build args are essential for projects that need to inject secrets or configuration at image build time without baking them into the image or committing them to source control. Common real-world examples include:

  • Private npm registry auth tokens (e.g. GitHub Packages, Artifactory)
  • Font Awesome Pro license keys
  • Private gem/package credentials (e.g. Sidekiq Pro)
  • Any multi-stage Dockerfile that uses ARG to gate access to private dependencies

Without --build-arg support, teams adopting Apple Container via container-compose are blocked from migrating existing Docker-based CI/CD workflows that rely on this flag.

Proposed Implementation

The build command should be updated to:

Accept --build-arg as a repeatable option (i.e. it can be specified multiple times), taking a KEY=VALUE string each time.
For each service being built, pass each provided --build-arg value through to the underlying container build invocation via its own --build-arg flags.

References

docker compose build docs — --build-arg
container build CLI — already supports --build-arg

I appreciate all the work you've done on this project. 🍻

主要言語
Swift
スター
1k
フォーク
61
平均マージ
2日 4時間
マージ済み PR(30日)
17

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

Mcrich23/Container-Compose のほかの issue

Mcrich23/Container-Compose の issue をすべて見る

似ている issue

Swift の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。