Skip to content

Commit dca25b6

Browse files
committed
build: give up and assume arm64 is arm64v8
1 parent b5f357c commit dca25b6

File tree

1 file changed

+27
-99
lines changed

1 file changed

+27
-99
lines changed

.github/workflows/main.yml

Lines changed: 27 additions & 99 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ on:
88
push:
99
branches: main
1010

11+
env:
12+
TARGET_PLATFORMS: linux/amd64,linux/arm64/v8
13+
1114
jobs:
1215
docker:
1316
strategy:
@@ -36,8 +39,6 @@ jobs:
3639
runs-on: ${{ matrix.os }}
3740
permissions:
3841
packages: write
39-
env:
40-
PLATFORMS: 'linux/amd64 linux/arm64/v8'
4142

4243
steps:
4344
-
@@ -71,58 +72,6 @@ jobs:
7172
echo BASE_IMAGE_DIGEST="$(digest_of "$SOURCE_IMAGE")" >> "$GITHUB_OUTPUT"
7273
echo 'IMAGE_DESCRIPTION=${{ github.event.repository.description }}. See ${{ github.server_url }}/${{ github.repository }} for more info.' >> "$GITHUB_OUTPUT"
7374
74-
# -
75-
# name: Buildroot
76-
# uses: docker/build-push-action@v6
77-
# with:
78-
# provenance: false
79-
# platforms: |
80-
# linux/amd64
81-
# linux/arm64/v8
82-
# context: "."
83-
# file: Dockerfile.alpine
84-
# target: buildroot
85-
# cache-to: |
86-
# type=gha
87-
# cache-from: |
88-
# type=gha
89-
# type=registry,ref=${{ steps.image_env.outputs.IMAGE_TAG }}-buildroot
90-
# type=registry,ref=${{ steps.image_env.outputs.SOURCE_IMAGE }}@${{ steps.image_env.outputs.BASE_IMAGE_DIGEST }}
91-
# build-args: |
92-
# ALPINE_VERSION=${{ steps.image_env.outputs.ALPINE_VERSION }}
93-
# BASE_IMAGE_DIGEST=${{ steps.image_env.outputs.BASE_IMAGE_DIGEST }}
94-
# PYTHON_VERSION=${{ steps.image_env.outputs.PYTHON_VERSION }}
95-
# SOURCE_IMAGE=${{ steps.image_env.outputs.SOURCE_IMAGE }}
96-
# BUILD_ROOT=/d
97-
# tags: "${{ steps.image_env.outputs.IMAGE_TAG }}-buildroot"
98-
# outputs: type=oci,dest=${{ steps.image_env.outputs.IMAGE_HOME }}/buildroot.tar
99-
# -
100-
# name: distroless
101-
# uses: docker/build-push-action@v6
102-
# with:
103-
# provenance: false
104-
# platforms: |
105-
# linux/amd64
106-
# linux/arm64/v8
107-
# context: "."
108-
# file: Dockerfile.alpine
109-
# # target: distroless-python
110-
# cache-from: |
111-
# type=gha
112-
# type=registry,ref=${{ steps.image_env.outputs.IMAGE_TAG }}
113-
# type=registry,ref=${{ steps.image_env.outputs.IMAGE_TAG }}-buildroot
114-
# type=registry,ref=${{ steps.image_env.outputs.SOURCE_IMAGE }}@${{ steps.image_env.outputs.BASE_IMAGE_DIGEST }}
115-
# cache-to: |
116-
# type=gha
117-
# build-args: |
118-
# ALPINE_VERSION=${{ steps.image_env.outputs.ALPINE_VERSION }}
119-
# BASE_IMAGE_DIGEST=${{ steps.image_env.outputs.BASE_IMAGE_DIGEST }}
120-
# PYTHON_VERSION=${{ steps.image_env.outputs.PYTHON_VERSION }}
121-
# SOURCE_IMAGE=${{ steps.image_env.outputs.SOURCE_IMAGE }}
122-
# BUILD_ROOT=/d
123-
# tags: "${{ steps.image_env.outputs.IMAGE_TAG }}"
124-
# outputs: type=oci,dest=${{ steps.image_env.outputs.IMAGE_HOME }}/image.tar
125-
12675
-
12776
name: Login to GitHub Container Registry
12877
if: ${{ matrix.repository == 'ghcr.io' }}
@@ -140,42 +89,27 @@ jobs:
14089
username: ${{ github.repository_owner }}
14190
password: ${{ secrets.DOCKERHUB_TOKEN }}
14291
-
143-
env:
144-
IMAGE_URI: ${{ steps.image_env.outputs.IMAGE_TAG }}-buildroot
145-
IMAGE_HOME: ${{ steps.image_env.outputs.IMAGE_HOME }}
146-
run: |
147-
for platform in $PLATFORMS
148-
do
149-
docker build --platform "$platform" --push --cache-to type=gha --cache-from type=gha --build-arg 'ALPINE_VERSION=${{ steps.image_env.outputs.ALPINE_VERSION }}' --build-arg 'BASE_IMAGE_DIGEST=${{ steps.image_env.outputs.BASE_IMAGE_DIGEST }}' --build-arg 'PYTHON_VERSION=${{ steps.image_env.outputs.PYTHON_VERSION }}' --build-arg 'SOURCE_IMAGE=${{ steps.image_env.outputs.SOURCE_IMAGE }}' --build-arg 'BUILD_ROOT=/d' --tag "${IMAGE_URI}-$(echo "${platform}" | tr '/' '-' )" -f Dockerfile.alpine .
150-
echo "${IMAGE_URI}-$(echo "${platform}" | tr '/' '-' )" | tee -a $IMAGE_HOME/images.txt
151-
done
152-
docker manifest create "${IMAGE_URI}" $(cat $IMAGE_HOME/images.txt)
153-
docker manifest push "${IMAGE_URI}"
154-
# -
155-
# name: Upload Buildroot
156-
# uses: docker/build-push-action@v6
157-
# with:
158-
# push: true
159-
# provenance: false
160-
# platforms: |
161-
# linux/amd64
162-
# linux/arm64/v8
163-
# context: "."
164-
# file: Dockerfile.alpine
165-
# target: buildroot
166-
# cache-to: |
167-
# type=gha
168-
# cache-from: |
169-
# type=gha
170-
# type=registry,ref=${{ steps.image_env.outputs.IMAGE_TAG }}-buildroot
171-
# type=registry,ref=${{ steps.image_env.outputs.SOURCE_IMAGE }}@${{ steps.image_env.outputs.BASE_IMAGE_DIGEST }}
172-
# build-args: |
173-
# ALPINE_VERSION=${{ steps.image_env.outputs.ALPINE_VERSION }}
174-
# BASE_IMAGE_DIGEST=${{ steps.image_env.outputs.BASE_IMAGE_DIGEST }}
175-
# PYTHON_VERSION=${{ steps.image_env.outputs.PYTHON_VERSION }}
176-
# SOURCE_IMAGE=${{ steps.image_env.outputs.SOURCE_IMAGE }}
177-
# BUILD_ROOT=/d
178-
# tags: "${{ steps.image_env.outputs.IMAGE_TAG }}-buildroot"
92+
name: Upload Buildroot
93+
uses: docker/build-push-action@v6
94+
with:
95+
push: true
96+
platforms: ${{ env.TARGET_PLATFORMS }}
97+
context: "."
98+
file: Dockerfile.alpine
99+
target: buildroot
100+
cache-to: |
101+
type=gha,mode=max
102+
cache-from: |
103+
type=gha
104+
type=registry,ref=${{ steps.image_env.outputs.IMAGE_TAG }}-buildroot
105+
type=registry,ref=${{ steps.image_env.outputs.SOURCE_IMAGE }}@${{ steps.image_env.outputs.BASE_IMAGE_DIGEST }}
106+
build-args: |
107+
ALPINE_VERSION=${{ steps.image_env.outputs.ALPINE_VERSION }}
108+
BASE_IMAGE_DIGEST=${{ steps.image_env.outputs.BASE_IMAGE_DIGEST }}
109+
PYTHON_VERSION=${{ steps.image_env.outputs.PYTHON_VERSION }}
110+
SOURCE_IMAGE=${{ steps.image_env.outputs.SOURCE_IMAGE }}
111+
BUILD_ROOT=/d
112+
tags: "${{ steps.image_env.outputs.IMAGE_TAG }}-buildroot"
179113
-
180114
name: Upload
181115
uses: docker/build-push-action@v6
@@ -184,13 +118,10 @@ jobs:
184118
with:
185119
push: true
186120
context: "."
187-
provenance: false
188-
platforms: |
189-
linux/amd64
190-
linux/arm64/v8
121+
platforms: ${{ env.TARGET_PLATFORMS }}
191122
file: Dockerfile.alpine
192123
cache-to: |
193-
type=gha
124+
type=gha,mode=max
194125
cache-from: |
195126
type=gha
196127
type=registry,ref=${{ steps.image_env.outputs.IMAGE_TAG }}
@@ -221,10 +152,7 @@ jobs:
221152
uses: docker/build-push-action@v6
222153
with:
223154
context: "examples/simple-flask"
224-
provenance: false
225-
platforms: |
226-
linux/amd64
227-
linux/arm64/v8
155+
platforms: ${{ env.TARGET_PLATFORMS }}
228156
cache-from: |
229157
type=gha
230158
type=registry,ref=${{ steps.image_env.outputs.IMAGE_TAG }}

0 commit comments

Comments
 (0)