Skip to content

Commit

Permalink
Add pushing container image to public AWS ECR
Browse files Browse the repository at this point in the history
  • Loading branch information
pmalek committed Dec 29, 2020
1 parent cd8cc58 commit bb928fd
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/release_builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,5 @@ jobs:
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
CR_PAT: ${{ secrets.CR_PAT }}
CR_OWNER: USERNAME
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_PUBLIC_ECR_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_PUBLIC_ECR_SECRET_ACCESS_KEY }}
16 changes: 16 additions & 0 deletions ci/_build_functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,22 @@ function push_docker_image() {
echo "Pushing docker image ${GHCR_IO_DOCKER_TAG}..."
docker push "${GHCR_IO_DOCKER_TAG}"
fi

if [[ -n "${AWS_ACCESS_KEY_ID}" && -n "${AWS_SECRET_ACCESS_KEY}" ]]; then
local ECR_URL
readonly ECR_URL="public.ecr.aws/sumologic"

aws ecr-public get-login-password --region us-east-1 \
| docker login --username AWS --password-stdin "${ECR_URL}"

local ECR_TAG
readonly ECR_TAG="public.ecr.aws/${docker_tag}:${version}"

echo "Tagging docker image ${docker_tag}:local with ${ECR_TAG}..."
docker tag "${docker_tag}:local" "${ECR_TAG}"
echo "Pushing docker image ${ECR_TAG}..."
docker push "${ECR_TAG}"
fi
}

function push_helm_chart() {
Expand Down

0 comments on commit bb928fd

Please sign in to comment.