docker:build

strong-opx docker:build

usage: strong-opx docker:build [-h] [--name NAME] [--ssh] [--ssh-key SSH_KEY] [--push] [--build-arg BUILD_ARGS [BUILD_ARGS ...]] [--tag DOCKER_TAGS [DOCKER_TAGS ...]] [--project PROJECT] [--env ENVIRONMENT]
                               [-v {0,1,2,3}] [--traceback]
                               path

positional arguments

path

Docker build context

options

-h, --help

show this help message and exit

--name <name>

Image name. Default: directory name

--ssh

Run ssh-agent and add ssh key to the build context

--ssh-key <ssh_key>

When –ssh is used, use this key instead of the default

--push

Push built image to ECR

--build-arg <build_args>

Additional build args to docker-build (values will be auto-resolved from stored vars)

--tag <docker_tags>

Additional tags to apply. latest tag will always be included

--project <project>

Select project by its name. If missing, strong-opx will attempt to auto-select project based on current working directory and its parents and looking for presence of configured project

--env <environment>

Environment name. If project has only one environment that will be auto selected

-v {0,1,2,3}, --verbosity {0,1,2,3}

Verbosity level; 0=minimal output, 1=normal output, 2=verbose output, 3=very verbose output.

--traceback

Raise instead of handling known exceptions

All built images when pushed to ECR will be tagged with latest, <environment>-latest alongside a generated unique tag of format: <environment>-<revision>.<vcs-head-sha-hash>. The <revision> is an auto-incrementing number unique to the environment. <vcs-head-sha-hash> is the SHA-1 hash of the HEAD commit in the VCS repository and will only be included in case of git repository.

Note

If a project has two environments within the same AWS region and the --name value is the same for both environments, using latest tag can cause conflicts.

For example, if a project had two environments, staging and development, in the us-east-1 region of the same AWS account and the following commands were run:

strong-opx docker-build ./my-project --env=staging --push
strong-opx docker-build ./my-project -env=development --push

Both commands would push the newly-built Docker image to the same [AWS account]/my-project ECR repository overriding latest tag.

To avoid this use <environment>-latest tag instead of latest tag.