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

Aperta
#69 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

  • #143 di @OrtegaMatias — chiusa senza merge

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
25/100
Tipo di issue
Funzionalità
Chiarezza
Specificata chiaramente
Stato di attività
Ferma
Stack tecnologico
swift
Ambito
cli

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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. 🍻

Lingua principale
Swift
Stelle
1k
Fork
61
Merge medio
2g 4h
PR unite (30g)
17

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di Mcrich23/Container-Compose

Tutte le issue di Mcrich23/Container-Compose

Issue simili

Altre issue su Swift

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.