Skip to content

Commit e88365b

Browse files
committed
fix(workflow): use runners with different architectures instead of QEMU
1 parent 3137d57 commit e88365b

File tree

3 files changed

+42
-25
lines changed

3 files changed

+42
-25
lines changed

.github/workflows/push-dev-image-on-commit.yml

Lines changed: 26 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,16 @@ on:
1212
workflow_dispatch:
1313

1414
jobs:
15-
build:
16-
runs-on: ubuntu-latest
15+
build-test-push:
16+
strategy:
17+
matrix:
18+
include:
19+
- runner: ubuntu-latest
20+
arch: amd64
21+
- runner: ubuntu-latest-arm64
22+
arch: arm64
23+
24+
runs-on: ${{ matrix.runner }}
1725

1826
env:
1927
APISIX_DOCKER_TAG: master-debian-dev
@@ -47,22 +55,27 @@ jobs:
4755
exit 125
4856
fi
4957
50-
- name: Login to Docker Hub
58+
- name: Push apisix image to Docker Hub
5159
if: github.ref == 'refs/heads/master'
60+
run: |
61+
make push-on-debian-dev
62+
env:
63+
ENV_OS_ARCH: ${{ matrix.arch }}
64+
65+
merge-tags:
66+
needs: build-test
67+
if: github.ref == 'refs/heads/master'
68+
runs-on: ubuntu-latest
69+
steps:
70+
- name: Login to Docker Hub
5271
uses: docker/login-action@v1
5372
with:
5473
username: ${{ secrets.DOCKERHUB_USER }}
5574
password: ${{ secrets.DOCKERHUB_TOKEN }}
5675

57-
- name: Set up QEMU
58-
if: github.ref == 'refs/heads/master'
59-
uses: docker/setup-qemu-action@v1
60-
61-
- name: Set up Docker Buildx
62-
if: github.ref == 'refs/heads/master'
63-
uses: docker/setup-buildx-action@v1
76+
- name: Check out the repo
77+
uses: actions/checkout@v4
6478

65-
- name: Push apisix image to Docker Hub
66-
if: github.ref == 'refs/heads/master'
79+
- name: Merge architecture-specific tags
6780
run: |
68-
make push-multiarch-dev-on-debian
81+
make merge-dev-tags

Makefile

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -504,16 +504,19 @@ build-on-debian-dev:
504504
-f ./docker/debian-dev/Dockerfile .
505505
@$(call func_echo_success_status, "$@ -> [ Done ]")
506506

507-
### push-multiarch-dev-on-debian : Push apache/apisix:dev image
508-
.PHONY: push-multiarch-dev-on-debian
509-
push-multiarch-dev-on-debian:
507+
.PHONY: push-on-debian-dev
508+
push-on-debian-dev:
510509
@$(call func_echo_status, "$@ -> [ Start ]")
511-
$(ENV_DOCKER) buildx build --network=host --push \
512-
-t $(IMAGE_NAME):dev \
513-
--platform linux/amd64,linux/arm64 \
514-
--build-arg CODE_PATH=. \
515-
--build-arg ENTRYPOINT_PATH=./docker/debian-dev/docker-entrypoint.sh \
516-
--build-arg INSTALL_BROTLI=./docker/debian-dev/install-brotli.sh \
517-
--build-arg CHECK_STANDALONE_CONFIG=./docker/utils/check_standalone_config.sh \
518-
-f ./docker/debian-dev/Dockerfile .
510+
$(ENV_DOCKER) tag $(ENV_APISIX_IMAGE_TAG_NAME)-debian-dev $(IMAGE_NAME):dev-$(ENV_OS_ARCH)
511+
$(ENV_DOCKER) push $(IMAGE_NAME):dev-$(ENV_OS_ARCH)
512+
@$(call func_echo_success_status, "$@ -> [ Done ]")
513+
514+
### merge-dev-tags : Merge architecture-specific dev tags into a single dev tag
515+
.PHONY: merge-dev-tags
516+
merge-dev-tags:
517+
@$(call func_echo_status, "$@ -> [ Start ]")
518+
$(ENV_DOCKER) manifest create $(IMAGE_NAME):dev \
519+
$(IMAGE_NAME):dev-amd64 \
520+
$(IMAGE_NAME):dev-arm64
521+
$(ENV_DOCKER) manifest push $(IMAGE_NAME):dev
519522
@$(call func_echo_success_status, "$@ -> [ Done ]")

docker/debian-dev/Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ FROM debian:bullseye-slim AS build
1818

1919
ARG ENABLE_PROXY=false
2020
ARG CODE_PATH
21+
ARG TARGETARCH
2122

2223
ENV DEBIAN_FRONTEND=noninteractive
2324
ENV ENV_INST_LUADIR=/usr/local/apisix
@@ -48,7 +49,7 @@ ARG CHECK_STANDALONE_CONFIG=./check_standalone_config.sh
4849
COPY --from=build /usr/local/apisix /usr/local/apisix
4950
COPY --from=build /usr/local/openresty /usr/local/openresty
5051
COPY --from=build /usr/bin/apisix /usr/bin/apisix
51-
COPY --from=build /usr/lib/x86_64-linux-gnu/libyaml* /usr/local/lib/
52+
COPY --from=build /usr/lib/${TARGETARCH}-linux-gnu/libyaml* /usr/local/lib/
5253

5354
COPY ${INSTALL_BROTLI} /install-brotli.sh
5455
RUN chmod +x /install-brotli.sh \

0 commit comments

Comments
 (0)