Skip to content

Commit ee68b0e

Browse files
committed
Use docker buildx
1 parent 1a70896 commit ee68b0e

File tree

2 files changed

+35
-6
lines changed

2 files changed

+35
-6
lines changed

.github/workflows/build.yml

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,29 @@ on: [push]
88
jobs:
99
build-image:
1010
runs-on: ubuntu-latest
11-
name: Build and test docker image
11+
name: Build and test docker image (${{ matrix.platform }})
12+
strategy:
13+
fail-fast: false
14+
matrix:
15+
# Base image only has amd64
16+
platform: ["linux/amd64", "linux/arm/v7"]
1217
steps:
1318
- name: Checkout repository
1419
uses: actions/checkout@v3
15-
- name: Build image
20+
# https://github.com/docker/setup-qemu-action
21+
- name: Set up QEMU
22+
uses: docker/setup-qemu-action@v1
23+
# https://github.com/docker/setup-buildx-action
24+
- name: Set up Docker Buildx
25+
uses: docker/setup-buildx-action@v1
26+
- name: Build action image
1627
run: make docker-build
17-
- name: Test image
28+
env:
29+
DOCKER_BUILDKIT: 1
30+
PLATFORM: "${{ matrix.platform }}"
31+
- name: Build action image
1832
run: make test
33+
env:
34+
DOCKER_BUILDKIT: 1
35+
COMPOSE_DOCKER_CLI_BUILD: 1
36+
PLATFORM: "${{ matrix.platform }}"

Makefile

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,24 @@
11
IMAGE_TAG ?= action-docker-compose
22
IMAGE_TAG_GHCR ?= ghcr.io/sudo-bot/docker-openldap/docker-openldap:latest
33

4-
.PHONY: update-tags docker-build
4+
# All: linux/amd64,linux/arm64,linux/riscv64,linux/ppc64le,linux/s390x,linux/386,linux/mips64le,linux/mips64,linux/arm/v7,linux/arm/v6
5+
PLATFORM ?= linux/amd64
6+
7+
ACTION ?= load
8+
PROGRESS_MODE ?= plain
9+
10+
.PHONY: update-tags docker-build docker-push
511

612
docker-build:
7-
docker build ./docker \
13+
# https://github.com/docker/buildx#building
14+
docker buildx build \
815
--tag $(IMAGE_TAG) \
16+
--progress $(PROGRESS_MODE) \
17+
--platform $(PLATFORM) \
918
--build-arg VCS_REF=`git rev-parse HEAD` \
10-
--build-arg BUILD_DATE=`date -u +"%Y-%m-%dT%H:%M:%SZ"`
19+
--build-arg BUILD_DATE=`date -u +"%Y-%m-%dT%H:%M:%SZ"` \
20+
--$(ACTION) \
21+
./docker
1122

1223
docker-tag-ghcr:
1324
docker tag $(IMAGE_TAG) $(IMAGE_TAG_GHCR)

0 commit comments

Comments
 (0)