Skip to content

Docker build args sourced from Shell environment variables #1599

@flyinprogrammer

Description

@flyinprogrammer

So we'd like to have copilot source environment variables from the shell that copilot is run in as build arguments into the docker build command. And it either already does this, and I am dumb, or it does not.

In my mind some form of the following might work:

manifest.yml:

image:
  build:
    dockerfile: path/to/dockerfile
    context: context/dir
    args:
      SECRET_PASSWORD: {{ .Env.SECRET_PASSWORD_IN_SHELL_ENV }}

In my shell:

export SECRET_PASSWORD_IN_SHELL_ENV="ssshthisissecret"
copilot deploy
# at some point this would happen:  docker build -f Dockerfile --build-arg SECRET_PASSWORD=ssshthisissecret

I thought maybe, perhaps, we were clever and ran the manifest file through go template before shoving it into a struct, but i'm either stupid, or we aren't doing this? Happy to provide a PR and shame on me for not running this in a debugger before opening this issue, but alas here we are.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/manifestIssues about infrastructure-as-code templates.type/featureIssues that are new feature requests.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions