This directory contains the Dockerfile
used to build the Docker image capable of running this application.
It includes a number of helper scripts to be run by the CI/CD pipeline but can also be run locally to build the image.
There are two ways to build this application, from the CAE Artifactory or from a local poetry build.
Use the build-docker.sh
script to build the docker image. There are two required arguments that must
be set:
- service-name: The name of the service being built (from pyproject.toml)
- service-version: The version of the service being built
This script will then call Docker build which will in turn retrieve the given version of the service from Artifactory and install it into the Docker image. The docker tag of the built image will be returned from the script.
Example:
./docker/build-docker.sh -n podaac-tig -v 0.1.0
First build the project with Poetry.
poetry build
That will create a folder dist/
and a wheel file that is named with the version of the software that was built.
Similar to building from Artifactory, the buld-docker.sh
script can be used to build the docker image from the
local wheel file. In this case there are still two required arguments that must be set:
- service-name: The name of the service being built (from pyproject.toml)
- service-version: The version of the service being built (also from pyproject.toml)
In order to use the local wheel file, call the build-docker.sh
script with the optional argument --local
. This
will cause the docker image to use the local wheel file instead of downloading the software from Artifactory.
The docker tag of the built image will be returned from the script.
Example:
./docker/build-docker.sh -n podaac-tig -v 0.1.0 --local
The Docker image can be run directly using the docker run
command.
The push-docker-ecr.sh
script can be used to push a docker image to AWS ECR. There are two required arguments:
- tf-venue: The target venue for uploading (sit, uat, or ops).
- docker-tag: The docker tage of the image being pushed
The easiest way to use the push-docker-ecr.sh
script is to first call build-docker.sh
and save the output to the
docker_tag
environment variable. Then call push-docker-ecr.sh
.
Example:
export docker_tag=$(./docker/build-docker.sh -n podaac-tig -v 0.1.0)
./docker/push-docker-ecr.sh -v sit -t $docker_tag