|
37 | 37 | if: github.repository == 'apache/cloudstack-kubernetes-provider' && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) |
38 | 38 | runs-on: ubuntu-22.04 |
39 | 39 | steps: |
40 | | - - name: Login to Docker Registry |
41 | | - uses: docker/login-action@v3 |
42 | | - with: |
43 | | - registry: ${{ secrets.DOCKER_REGISTRY }} |
44 | | - username: ${{ secrets.DOCKERHUB_USER }} |
45 | | - password: ${{ secrets.DOCKERHUB_TOKEN }} |
46 | | - |
47 | 40 | - name: Set Docker repository name |
48 | 41 | run: echo "DOCKER_REPOSITORY=apache" >> $GITHUB_ENV |
49 | 42 |
|
|
57 | 50 | - name: Set Docker image FULL TAG |
58 | 51 | run: echo "FULL_TAG=$(if [ "${{ secrets.DOCKER_REGISTRY }}" = "" ];then echo ${DOCKER_REPOSITORY}/cloudstack-kubernetes-provider:${TAG};else echo ${{ secrets.DOCKER_REGISTRY }}/${DOCKER_REPOSITORY}/cloudstack-kubernetes-provider:${TAG};fi)" >> $GITHUB_ENV |
59 | 52 |
|
60 | | - - name: Build the Docker image for cloudstack-kubernetes-provider |
61 | | - run: docker build . --file Dockerfile --tag ${FULL_TAG} |
| 53 | + - name: Set up Docker Buildx |
| 54 | + uses: docker/setup-buildx-action@v3 |
62 | 55 |
|
63 | | - - name: Push Docker image to Docker Registry |
64 | | - run: docker push ${FULL_TAG} |
| 56 | + - name: Login to Docker Registry |
| 57 | + uses: docker/login-action@v3 |
| 58 | + with: |
| 59 | + registry: ${{ secrets.DOCKER_REGISTRY }} |
| 60 | + username: ${{ secrets.DOCKERHUB_USER }} |
| 61 | + password: ${{ secrets.DOCKERHUB_TOKEN }} |
| 62 | + |
| 63 | + - name: Build and push Docker image for cloudstack-kubernetes-provider (multi-arch) |
| 64 | + uses: docker/build-push-action@v5 |
| 65 | + with: |
| 66 | + context: . |
| 67 | + file: ./Dockerfile |
| 68 | + platforms: linux/amd64,linux/arm64 |
| 69 | + push: true |
| 70 | + tags: ${{ env.FULL_TAG }} |
| 71 | + cache-from: type=registry,ref=${{ env.FULL_TAG }}-cache |
| 72 | + cache-to: type=registry,ref=${{ env.FULL_TAG }}-cache,mode=max |
0 commit comments