Skip to content

Commit

Permalink
Push to ECR
Browse files Browse the repository at this point in the history
  • Loading branch information
timmyers committed Jun 2, 2021
1 parent abcb542 commit edf8465
Showing 1 changed file with 22 additions and 16 deletions.
38 changes: 22 additions & 16 deletions .github/workflows/container-image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ on:
jobs:
buildx:
# this is to prevent the job to run at forked projects
if: github.repository == 'kubernetes-sigs/aws-ebs-csi-driver'
env:
IMAGE: aws-ebs-csi-driver
DEB_BUILD_TAG: aws-ebs-csi-driver:debian
Expand All @@ -27,13 +26,13 @@ jobs:
--platform=linux/arm64,linux/amd64 \
--output="type=image,push=false" . \
--target=debian-base
- name: Build amazonlinux target
run: |
docker buildx build \
-t $AL2_BUILD_TAG \
--platform=linux/arm64,linux/amd64 \
--output="type=image,push=false" . \
--target=amazonlinux
# - name: Build amazonlinux target
# run: |
# docker buildx build \
# -t $AL2_BUILD_TAG \
# --platform=linux/arm64,linux/amd64 \
# --output="type=image,push=false" . \
# --target=amazonlinux
- name: Set environment variables
run: |
BRANCH=$(echo $GITHUB_REF | cut -d'/' -f3)
Expand All @@ -44,16 +43,23 @@ jobs:
TAG=$BRANCH
fi
echo "TAG=$TAG" >> $GITHUB_ENV
- name: Login to Docker Hub
uses: docker/login-action@v1
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
username: ${{ secrets.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Push amazonlinux target to Docker Hub
aws-access-key-id: ${{ secrets.GH_ACTIONS_AWS_KEY_ID }}
aws-secret-access-key: ${{ secrets.GH_ACTIONS_SECRET_ACCESS_KEY }}
role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}
role-external-id: ${{ secrets.AWS_ROLE_EXTERNAL_ID }}
role-duration-seconds: 1200
role-session-name: GitHubActions
aws-region: us-east-1
- name: log-in to ECR
run: aws ecr get-login-password --region us-east-1 | docker login --username AWS --password-stdin 204717343847.dkr.ecr.us-east-1.amazonaws.com
- name: Push debian target to Docker Hub
run: |
AL2_PUSH_TAG="amazon/$IMAGE:$TAG-amazonlinux"
DEB_PUSH_TAG="204717343847.dkr.ecr.us-east-1.amazonaws.com/infura-dedicated/$IMAGE:$TAG"
docker buildx build \
-t $AL2_PUSH_TAG \
-t $DEB_PUSH_TAG \
--platform=linux/arm64,linux/amd64 \
--output="type=image,push=true" . \
--target=amazonlinux
--target=debian-base

0 comments on commit edf8465

Please sign in to comment.