Skip to content

Commit 9f511ea

Browse files
authored
Merge pull request mendhak#29 from mendhak/issue23-arms
Multi platform Docker image builds using Github Actions: amd64, armv6, armv7, arm64v8 ppc64le, s390x
2 parents d89935a + 5b33bda commit 9f511ea

3 files changed

Lines changed: 40 additions & 5 deletions

File tree

.github/workflows/build.yml

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,26 @@ jobs:
1717
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
1818
- uses: actions/checkout@v2
1919

20-
- name: Build and test the image
20+
- name: Set up QEMU
21+
uses: docker/setup-qemu-action@v1
22+
- name: Set up Docker Buildx
23+
id: buildx
24+
uses: docker/setup-buildx-action@v1
25+
26+
- name: Inspect builder
27+
run: |
28+
echo "Name: ${{ steps.buildx.outputs.name }}"
29+
echo "Endpoint: ${{ steps.buildx.outputs.endpoint }}"
30+
echo "Status: ${{ steps.buildx.outputs.status }}"
31+
echo "Flags: ${{ steps.buildx.outputs.flags }}"
32+
echo "Platforms: ${{ steps.buildx.outputs.platforms }}"
33+
34+
- name: Build the image multiplatform
35+
run: docker buildx build --output "type=image,push=false" --platform linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64/v8,linux/ppc64le,linux/s390x --tag mendhak/http-https-echo:latest --file ./Dockerfile .
36+
37+
- name: Build the image single platform and run tests
2138
run: ./tests.sh
22-
39+
2340
- name: Scan the image
2441
id: scan
2542
uses: anchore/scan-action@v2

.github/workflows/publish.yml

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,37 @@ jobs:
1313
steps:
1414
- uses: actions/checkout@v2
1515

16+
- name: Set up QEMU
17+
uses: docker/setup-qemu-action@v1
18+
19+
- name: Set up Docker Buildx
20+
id: buildx
21+
uses: docker/setup-buildx-action@v1
22+
23+
- name: Inspect builder
24+
run: |
25+
echo "Name: ${{ steps.buildx.outputs.name }}"
26+
echo "Endpoint: ${{ steps.buildx.outputs.endpoint }}"
27+
echo "Status: ${{ steps.buildx.outputs.status }}"
28+
echo "Flags: ${{ steps.buildx.outputs.flags }}"
29+
echo "Platforms: ${{ steps.buildx.outputs.platforms }}"
30+
1631
- name: Build the image
17-
run: docker build -t mendhak/test-image .
32+
run: docker buildx build --output "type=image,push=false" --platform linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64/v8,linux/ppc64le,linux/s390x --tag mendhak/http-https-echo:latest --file ./Dockerfile .
33+
1834
- name: Get the version
1935
id: get_version
2036
run: echo ::set-output name=VERSION::$(echo $GITHUB_REF | cut -d / -f 3)
37+
2138
- name: Log in to Docker Hub
2239
uses: docker/login-action@v1
2340
with:
2441
username: ${{ secrets.DOCKER_HUB_USERNAME }}
2542
password: ${{ secrets.DOCKER_HUB_TOKEN }}
43+
2644
- name: Push to Docker Hub
2745
uses: docker/build-push-action@v2
2846
with:
2947
push: true
30-
tags: mendhak/http-https-echo:${{ steps.get_version.outputs.VERSION }}
48+
tags: mendhak/http-https-echo:${{ steps.get_version.outputs.VERSION }}
49+
platforms: linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64/v8,linux/ppc64le,linux/s390x

tests.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ if ! [ -x "$(command -v jq)" ]; then
2626
sudo apt -y install jq
2727
fi
2828

29-
3029
message " Build image "
3130
docker build -t mendhak/http-https-echo:latest .
3231

0 commit comments

Comments
 (0)