|
6 | 6 | types: [created] |
7 | 7 |
|
8 | 8 | jobs: |
9 | | - determine-tags: |
10 | | - runs-on: ubuntu-24.04 |
11 | | - outputs: |
12 | | - tags: ${{ steps.meta.outputs.tags }} |
| 9 | + build-and-push: |
| 10 | + runs-on: ubuntu-24.04-arm |
| 11 | + |
13 | 12 | steps: |
| 13 | + - name: Checkout code |
| 14 | + uses: actions/checkout@v4 |
| 15 | + |
| 16 | + - name: Set up QEMU |
| 17 | + uses: docker/setup-qemu-action@v3 |
| 18 | + |
| 19 | + - name: Set up Docker Buildx |
| 20 | + uses: docker/setup-buildx-action@v3 |
| 21 | + |
| 22 | + - name: Login to Docker Hub |
| 23 | + uses: docker/login-action@v3 |
| 24 | + with: |
| 25 | + username: ${{ secrets.DOCKER_USERNAME }} |
| 26 | + password: ${{ secrets.DOCKER_PASSWORD }} |
| 27 | + |
14 | 28 | - name: Determine Docker tags |
15 | 29 | id: meta |
16 | 30 | env: |
@@ -48,73 +62,12 @@ jobs: |
48 | 62 |
|
49 | 63 | echo "tags=$TAGS" >> "$GITHUB_OUTPUT" |
50 | 64 |
|
51 | | - build-amd64: |
52 | | - runs-on: ubuntu-24.04 |
53 | | - needs: determine-tags |
54 | | - steps: |
55 | | - - uses: actions/checkout@v4 |
56 | | - - uses: docker/setup-buildx-action@v3 |
57 | | - - uses: docker/login-action@v3 |
| 65 | + - name: Build and push multi-arch image |
| 66 | + uses: docker/build-push-action@v6 |
58 | 67 | with: |
59 | | - username: ${{ secrets.DOCKER_USERNAME }} |
60 | | - password: ${{ secrets.DOCKER_PASSWORD }} |
61 | | - - name: Build and push amd64 images |
62 | | - run: | |
63 | | - IFS=',' read -ra TAG_ARRAY <<< "${{ needs.determine-tags.outputs.tags }}" |
64 | | - TAGS="" |
65 | | - for TAG in "${TAG_ARRAY[@]}"; do |
66 | | - TAGS="$TAGS --tag ${TAG}-amd64" |
67 | | - done |
68 | | -
|
69 | | - docker buildx build . \ |
70 | | - -f docker/Dockerfile \ |
71 | | - --platform linux/amd64 \ |
72 | | - --push \ |
73 | | - $TAGS |
74 | | -
|
75 | | - build-arm64: |
76 | | - runs-on: ubuntu-24.04-arm |
77 | | - needs: determine-tags |
78 | | - steps: |
79 | | - - uses: actions/checkout@v4 |
80 | | - - uses: docker/setup-buildx-action@v3 |
81 | | - - uses: docker/login-action@v3 |
82 | | - with: |
83 | | - username: ${{ secrets.DOCKER_USERNAME }} |
84 | | - password: ${{ secrets.DOCKER_PASSWORD }} |
85 | | - - name: Build and push arm64 images |
86 | | - run: | |
87 | | - IFS=',' read -ra TAG_ARRAY <<< "${{ needs.determine-tags.outputs.tags }}" |
88 | | - TAGS="" |
89 | | - for TAG in "${TAG_ARRAY[@]}"; do |
90 | | - TAGS="$TAGS --tag ${TAG}-arm64" |
91 | | - done |
92 | | -
|
93 | | - docker buildx build . \ |
94 | | - -f docker/Dockerfile \ |
95 | | - --platform linux/arm64 \ |
96 | | - --push \ |
97 | | - $TAGS |
98 | | -
|
99 | | - push-manifest: |
100 | | - runs-on: ubuntu-24.04 |
101 | | - needs: [build-amd64, build-arm64, determine-tags] |
102 | | - steps: |
103 | | - - name: Login to Docker Hub |
104 | | - uses: docker/login-action@v3 |
105 | | - with: |
106 | | - username: ${{ secrets.DOCKER_USERNAME }} |
107 | | - password: ${{ secrets.DOCKER_PASSWORD }} |
108 | | - |
109 | | - - name: Create and push multi-arch manifest |
110 | | - run: | |
111 | | - IFS=',' read -ra TAG_ARRAY <<< "${{ needs.determine-tags.outputs.tags }}" |
112 | | -
|
113 | | - for TAG in "${TAG_ARRAY[@]}"; do |
114 | | - echo "Creating manifest for $TAG" |
115 | | - docker manifest create "$TAG" \ |
116 | | - --amend "${TAG}-amd64" \ |
117 | | - --amend "${TAG}-arm64" |
118 | | -
|
119 | | - docker manifest push "$TAG" |
120 | | - done |
| 68 | + context: . |
| 69 | + file: docker/Dockerfile |
| 70 | + platforms: linux/amd64,linux/arm64 |
| 71 | + push: true |
| 72 | + no-cache: true |
| 73 | + tags: ${{ steps.meta.outputs.tags }} |
0 commit comments