Skip to content
Discussion options

You must be logged in to vote

No — there isn’t a built-in SAM CLI flag that lets you inject Docker BuildArgs at build time without having them defined in template.yaml.

For image-based builds, SAM reads the Docker build configuration (Dockerfile, DockerContext, DockerTag, BuildArgs, etc.) from the resource Metadata in the template. sam build does not have an “override BuildArgs” option the way some other tools do.

Practical solutions that avoid committing a changing token into source control:

Option 1 (recommended): don’t use BuildArgs for auth, use a build-time secret/config mechanism

Instead of passing the CodeArtifact token as a Docker build-arg, pass it as an environment variable (or secret) into the build and hav…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@uldyssian-sh
Comment options

Answer selected by vicheey
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants