@@ -55,12 +55,20 @@ jobs:
5555 runs-on : ubuntu-latest
5656 steps :
5757 - uses : actions/checkout@v4
58+
5859 - name : Login to Docker Hub
5960 uses : docker/login-action@v3
6061 with :
6162 username : ${{ secrets.DOCKERHUB_TEAM_NAME }}
6263 password : ${{ secrets.DOCKERHUB_TOKEN }}
6364
65+ - name : Login to GitHub Container Registry
66+ uses : docker/login-action@v3
67+ with :
68+ registry : ghcr.io
69+ username : ${{ github.actor }}
70+ password : ${{ secrets.GITHUB_TOKEN }}
71+
6472 - name : Set up Docker Buildx
6573 uses : docker/setup-buildx-action@v3
6674
@@ -71,34 +79,33 @@ jobs:
7179 IMAGE_TAG_BRANCH_ORIG : ${{ needs.setup.outputs.CLEAN_BRANCH_NAME }}
7280 IMAGE_TAG_EPOCH_TIMESTAMP : ${{ needs.setup.outputs.EPOCH_TIMESTAMP }}
7381 REPO_NAME : ${{ secrets.DOCKERHUB_TEAM_NAME }}/drd-vpc-agent
82+ GHCR_REPO : ghcr.io/drdroidlab/drd-vpc-agent/drd-vpc-agent
7483 EVENT_NAME : ${{ github.event_name }}
7584 run : |
7685 echo "Building for repository"
77-
86+
7887 if [ "$EVENT_NAME" = "push" ]; then
7988 EXPORT_FLAG="--push"
8089 PLATFORMS="linux/amd64,linux/arm64"
8190 else
8291 EXPORT_FLAG="--load"
8392 PLATFORMS="linux/amd64"
8493 fi
85-
94+
8695 docker buildx build \
8796 --platform $PLATFORMS \
8897 --tag ${REPO_NAME}:$IMAGE_TAG_SHA \
8998 --tag ${REPO_NAME}:$IMAGE_TAG_EPOCH_TIMESTAMP \
9099 --tag ${REPO_NAME}:$IMAGE_TAG_BRANCH_ORIG \
91100 --tag ${REPO_NAME}:$IMAGE_TAG_BRANCH \
92101 --tag ${REPO_NAME}:latest \
102+ --tag ${GHCR_REPO}:$IMAGE_TAG_SHA \
103+ --tag ${GHCR_REPO}:$IMAGE_TAG_EPOCH_TIMESTAMP \
104+ --tag ${GHCR_REPO}:$IMAGE_TAG_BRANCH_ORIG \
105+ --tag ${GHCR_REPO}:$IMAGE_TAG_BRANCH \
106+ --tag ${GHCR_REPO}:latest \
93107 --build-arg BUILDKIT_INLINE_CACHE=1 \
94108 --build-arg COMMIT_HASH=$IMAGE_TAG_SHA \
95109 --file Dockerfile \
96110 $EXPORT_FLAG \
97- .
98-
99- # - name: Push to ECR
100- # if: github.event_name == 'push'
101- # run: |
102- # echo "Pushing to repository"
103- # REPO_NAME=${{ secrets.REPO_NAME }}
104- # docker push ${REPO_NAME} --all-tags
111+ .
0 commit comments