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

未关闭
#69 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

  • #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 小时
30 天内合并 PR
17

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

Mcrich23/Container-Compose 的其他 Issue

查看 Mcrich23/Container-Compose 的全部 Issue

相似的 Issue

更多 Swift Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。