Skip to content

Commit 65f1ee6

Browse files
chore: update debian base image to bookworm (#620)
1 parent 5f8e54a commit 65f1ee6

3 files changed

Lines changed: 38 additions & 27 deletions

File tree

.github/workflows/apisix_push_docker_hub.yaml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,12 @@ jobs:
6767
username: ${{ secrets.DOCKERHUB_USER }}
6868
password: ${{ secrets.DOCKERHUB_TOKEN }}
6969

70-
- name: push apisix:latest image to docker hub
70+
- name: Build multiarch image
71+
if: ${{ !startsWith(github.ref_name, 'release/apisix') }}
72+
run: |
73+
make build-multiarch-on-${{ matrix.platform }}
74+
75+
- name: Push apisix:latest image to Docker Hub
7176
if: ${{ startsWith(github.ref_name, 'release/apisix') && (matrix.platform == 'ubuntu') }}
7277
run: |
7378
make push-multiarch-on-latest

Makefile

Lines changed: 28 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -134,41 +134,47 @@ push-multiarch-dev-on-debian:
134134
@$(call func_echo_success_status, "$@ -> [ Done ]")
135135

136136

137-
### push-multiarch-on-ubuntu : Push apache/apisix:xx-ubuntu image
138-
.PHONY: push-multiarch-on-ubuntu
139-
push-multiarch-on-ubuntu:
137+
# $(1): platform, $(2): extra buildx flags (e.g. --push)
138+
define func_multiarch_build
140139
@$(call func_echo_status, "$@ -> [ Start ]")
141-
cp ./utils/*.sh ubuntu/
142-
$(ENV_DOCKER) buildx build --network=host --push \
143-
-t $(ENV_APISIX_IMAGE_TAG_NAME)-ubuntu \
140+
$(if $(filter-out redhat,$(1)),cp ./utils/*.sh $(1)/)
141+
$(ENV_DOCKER) buildx build --network=host $(2) \
142+
-t $(ENV_APISIX_IMAGE_TAG_NAME)-$(1) \
144143
--platform linux/amd64,linux/arm64 \
145-
-f ./ubuntu/Dockerfile ubuntu
146-
rm -f ubuntu/*.sh
144+
-f ./$(1)/Dockerfile $(1)
145+
$(if $(filter-out redhat,$(1)),rm -f $(1)/*.sh)
147146
@$(call func_echo_success_status, "$@ -> [ Done ]")
147+
endef
148+
149+
### build-multiarch-on-ubuntu : Build apache/apisix:xx-ubuntu multiarch image
150+
.PHONY: build-multiarch-on-ubuntu
151+
build-multiarch-on-ubuntu:
152+
$(call func_multiarch_build,ubuntu,)
153+
154+
### push-multiarch-on-ubuntu : Push apache/apisix:xx-ubuntu image
155+
.PHONY: push-multiarch-on-ubuntu
156+
push-multiarch-on-ubuntu:
157+
$(call func_multiarch_build,ubuntu,--push)
148158

159+
### build-multiarch-on-debian : Build apache/apisix:xx-debian multiarch image
160+
.PHONY: build-multiarch-on-debian
161+
build-multiarch-on-debian:
162+
$(call func_multiarch_build,debian,)
149163

150164
### push-multiarch-on-debian : Push apache/apisix:xx-debian image
151165
.PHONY: push-multiarch-on-debian
152166
push-multiarch-on-debian:
153-
@$(call func_echo_status, "$@ -> [ Start ]")
154-
cp ./utils/*.sh debian/
155-
$(ENV_DOCKER) buildx build --network=host --push \
156-
-t $(ENV_APISIX_IMAGE_TAG_NAME)-debian \
157-
--platform linux/amd64,linux/arm64 \
158-
-f ./debian/Dockerfile debian
159-
rm -f debian/*.sh
160-
@$(call func_echo_success_status, "$@ -> [ Done ]")
167+
$(call func_multiarch_build,debian,--push)
161168

169+
### build-multiarch-on-redhat : Build apache/apisix:xx-redhat multiarch image
170+
.PHONY: build-multiarch-on-redhat
171+
build-multiarch-on-redhat:
172+
$(call func_multiarch_build,redhat,)
162173

163174
### push-multiarch-on-redhat : Push apache/apisix:xx-redhat image
164175
.PHONY: push-multiarch-on-redhat
165176
push-multiarch-on-redhat:
166-
@$(call func_echo_status, "$@ -> [ Start ]")
167-
$(ENV_DOCKER) buildx build --network=host --push \
168-
-t $(ENV_APISIX_IMAGE_TAG_NAME)-redhat \
169-
--platform linux/amd64,linux/arm64 \
170-
-f ./redhat/Dockerfile redhat
171-
@$(call func_echo_success_status, "$@ -> [ Done ]")
177+
$(call func_multiarch_build,redhat,--push)
172178

173179
### push-multiarch-on-latest : Push apache/apisix:latest image
174180
.PHONY: push-multiarch-on-latest

debian/Dockerfile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,23 +15,23 @@
1515
# limitations under the License.
1616
#
1717

18-
FROM debian:bullseye-slim
18+
FROM debian:bookworm-slim
1919

2020
ARG APISIX_VERSION=3.16.0
2121

2222
RUN set -ex; \
2323
arch=$(dpkg --print-architecture); \
2424
apt update; \
2525
apt-get -y install --no-install-recommends wget gnupg ca-certificates curl;\
26-
codename=`grep -Po 'VERSION="[0-9]+ \(\K[^)]+' /etc/os-release`; \
26+
codename="debian12"; \
2727
case "${arch}" in \
2828
amd64) \
2929
wget -O - https://repos.apiseven.com/pubkey.gpg | apt-key add - \
30-
&& echo "deb https://repos.apiseven.com/packages/debian $codename main" | tee /etc/apt/sources.list.d/apisix.list \
30+
&& echo "deb https://repos.apiseven.com/packages/debian debian12 main" | tee /etc/apt/sources.list.d/apisix.list \
3131
;; \
3232
arm64) \
3333
wget -O - https://repos.apiseven.com/pubkey.gpg | apt-key add - \
34-
&& echo "deb https://repos.apiseven.com/packages/arm64/debian $codename main" | tee /etc/apt/sources.list.d/apisix.list \
34+
&& echo "deb https://repos.apiseven.com/packages/arm64/debian debian12 main" | tee /etc/apt/sources.list.d/apisix.list \
3535
;; \
3636
esac; \
3737
apt update \

0 commit comments

Comments
 (0)