Read the related article : Create the smallest and secured golang docker image based on scratch or distroless
✓ usage: make [target]
build-no-cache - Build the smallest and secured golang docker image based on scratch with no cache
build - Build the smallest and secured golang docker image based on scratch
docker-pull - docker pull latest images
help - Show help message
ls - List 'smallest-secured-golang' docker images
push-to-aws - Push docker image to AWS Elastic Container Registry
run - Run the smallest and secured golang docker image based on scratch
scan - Scan for known vulnerabilities the smallest and secured golang docker image based on scratch
make build && make run
One of AWS ECR pain points is that you can only have one image per repository. However, each repository can have multiple versions of the same image. You will first need to create the repository in ECR, either from the console or from the command line.
The commands in the makefile assumes you have AWS cli properly configured. Either by having the following environment variables defined: AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY. Or by having run the aws configure command beforehand.
Two variables have a default value assigned: AWS_REGION and AWS_ACCOUNT_NUMBER. The AWS_ACCOUNT_NUMBER is a 12-digit number. Please see the official documentation if you need to find out your account number.