Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: run docker build separately #583

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
79 changes: 45 additions & 34 deletions .github/workflows/apisix_dev_push_docker_hub.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
name: Build and Push apisix-dev to Docker DockerHub

name: Build and Push apisix-dev multi-arch to Docker Hub

on:
schedule:
# UTC 0:00 AM (See https://pubs.opengroup.org/onlinepubs/9699919799/utilities/crontab.html#tag_20_25_07)
- cron: "0 1 * * *"
push:
branches: [master]
Expand All @@ -12,57 +10,70 @@ on:
- '**/*.md'

jobs:
build:
runs-on: ubuntu-latest

build-arm64:
runs-on: buildjet-4vcpu-ubuntu-2204-arm
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can't use buildjet in apache repo

env:
APISIX_VERSION: master
APISIX_DOCKER_TAG: master-debian-dev

steps:
- name: Check out the repo
uses: actions/checkout@v2

- name: Build and run
run: |
make build-on-debian-dev
docker compose -f ./compose/docker-compose-master.yaml up -d
sleep 30
docker logs compose-apisix-1
- name: Set up QEMU
uses: docker/setup-qemu-action@v1

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Test APISIX
- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build and push ARM64 image
run: |
make push-multiarch-dev-on-debian PLATFORM=linux/arm64
docker pull apache/apisix:dev-arm64

curl http://127.0.0.1:9180/apisix/admin/routes/1 \
-H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
{
"uri": "/get",
"upstream": {
"type": "roundrobin",
"nodes": {
"httpbin.org:80": 1
}
}
}'
build-amd64:
runs-on: ubuntu-latest
env:
APISIX_VERSION: master
APISIX_DOCKER_TAG: master-debian-dev
steps:
- name: Check out the repo
uses: actions/checkout@v2

result_code=`curl -I -m 10 -o /dev/null -s -w %{http_code} http://127.0.0.1:9080/get`
if [[ $result_code -ne 200 ]];then
printf "result_code: %s\n" "$result_code"
exit 125
fi
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Build and push AMD64 image
run: |
make push-multiarch-dev-on-debian PLATFORM=linux/amd64
docker pull apache/apisix:dev-amd64

create-manifest:
runs-on: ubuntu-latest
needs: [build-arm64, build-amd64]
steps:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Push apisix image to Docker Hub
- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Create multi-arch manifest
run: |
make push-multiarch-dev-on-debian
docker buildx imagetools create --tag apache/apisix:dev \
apache/apisix:dev-arm64 \
apache/apisix:dev-amd64
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -112,15 +112,15 @@ build-on-debian:
rm -f debian/check_standalone_config.sh
@$(call func_echo_success_status, "$@ -> [ Done ]")


PLATFORM ?= linux/amd64
### push-on-alpine : Push apache/apisix:dev image
.PHONY: push-multiarch-dev-on-debian
push-multiarch-dev-on-debian:
@$(call func_echo_status, "$@ -> [ Start ]")
cp ./utils/check_standalone_config.sh debian-dev/check_standalone_config.sh
$(ENV_DOCKER) buildx build --network=host --push \
-t $(IMAGE_NAME):dev \
--platform linux/amd64,linux/arm64 \
-t $(IMAGE_NAME):dev-$(shell echo $(PLATFORM) | cut -d'/' -f2) \
--platform $(PLATFORM) \
-f ./debian-dev/Dockerfile debian-dev
rm -f debian-dev/check_standalone_config.sh
@$(call func_echo_success_status, "$@ -> [ Done ]")
Expand Down