This is an automated email from the ASF dual-hosted git repository. nic443 pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/apisix-docker.git
The following commit(s) were added to refs/heads/master by this push: new 77a0b16 feat: build apisix docker image for ubuntu 24.04 (#597) 77a0b16 is described below commit 77a0b169c06beef29e86dee7e6db44d6be704cae Author: Nic <qiany...@api7.ai> AuthorDate: Fri Jul 18 09:48:30 2025 +0800 feat: build apisix docker image for ubuntu 24.04 (#597) Signed-off-by: Nic <qiany...@api7.ai> --- .github/workflows/apisix_push_docker_hub.yaml | 3 +- Makefile | 45 ++++++++++++---- ubuntu/Dockerfile | 74 +++++++++++++++++++++++++++ {debian => utils}/docker-entrypoint.sh | 0 {debian => utils}/install-brotli.sh | 0 5 files changed, 110 insertions(+), 12 deletions(-) diff --git a/.github/workflows/apisix_push_docker_hub.yaml b/.github/workflows/apisix_push_docker_hub.yaml index fff5f60..6f566ba 100644 --- a/.github/workflows/apisix_push_docker_hub.yaml +++ b/.github/workflows/apisix_push_docker_hub.yaml @@ -10,6 +10,7 @@ jobs: fail-fast: false matrix: platform: + - ubuntu - debian - redhat env: @@ -61,7 +62,7 @@ jobs: uses: docker/setup-buildx-action@v1 - name: push apisix:latest image to docker hub - if: matrix.platform == 'debian' + if: matrix.platform == 'ubuntu' run: | make push-multiarch-on-latest diff --git a/Makefile b/Makefile index b044b82..9c00ce3 100644 --- a/Makefile +++ b/Makefile @@ -84,9 +84,9 @@ build-on-redhat: .PHONY: build-on-debian-dev build-on-debian-dev: @$(call func_echo_status, "$@ -> [ Start ]") - cp ./utils/check_standalone_config.sh debian-dev/check_standalone_config.sh + cp ./utils/*.sh debian-dev/ $(ENV_DOCKER) build -t $(ENV_APISIX_IMAGE_TAG_NAME)-debian-dev -f ./debian-dev/Dockerfile debian-dev - rm -f debian-dev/check_standalone_config.sh + rm -f debian-dev/*.sh @$(call func_echo_success_status, "$@ -> [ Done ]") ### build-on-debian-local-dev : Build apache/apisix:xx-debian-dev image @@ -103,13 +103,23 @@ else endif @$(call func_echo_success_status, "$@ -> [ Done ]") + +### build-on-ubuntu : Build apache/apisix:xx-ubuntu image +.PHONY: build-on-ubuntu +build-on-ubuntu: + @$(call func_echo_status, "$@ -> [ Start ]") + cp ./utils/*.sh ubuntu/ + $(ENV_DOCKER) build -t $(ENV_APISIX_IMAGE_TAG_NAME)-ubuntu -f ./ubuntu/Dockerfile ubuntu + rm -f ubuntu/*.sh + @$(call func_echo_success_status, "$@ -> [ Done ]") + ### build-on-debian : Build apache/apisix:xx-debian image .PHONY: build-on-debian build-on-debian: @$(call func_echo_status, "$@ -> [ Start ]") - cp ./utils/check_standalone_config.sh debian/check_standalone_config.sh + cp ./utils/*.sh debian/ $(ENV_DOCKER) build -t $(ENV_APISIX_IMAGE_TAG_NAME)-debian -f ./debian/Dockerfile debian - rm -f debian/check_standalone_config.sh + rm -f debian/*.sh @$(call func_echo_success_status, "$@ -> [ Done ]") @@ -117,12 +127,25 @@ build-on-debian: .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 + cp ./utils/*.sh debian-dev/ $(ENV_DOCKER) buildx build --network=host --push \ -t $(IMAGE_NAME):dev \ --platform linux/amd64,linux/arm64 \ -f ./debian-dev/Dockerfile debian-dev - rm -f debian-dev/check_standalone_config.sh + rm -f debian-dev/*.sh + @$(call func_echo_success_status, "$@ -> [ Done ]") + + +### push-multiarch-on-ubuntu : Push apache/apisix:xx-ubuntu image +.PHONY: push-multiarch-on-ubuntu +push-multiarch-on-ubuntu: + @$(call func_echo_status, "$@ -> [ Start ]") + cp ./utils/*.sh ubuntu/ + $(ENV_DOCKER) buildx build --network=host --push \ + -t $(ENV_APISIX_IMAGE_TAG_NAME)-ubuntu \ + --platform linux/amd64,linux/arm64 \ + -f ./ubuntu/Dockerfile ubuntu + rm -f ubuntu/*.sh @$(call func_echo_success_status, "$@ -> [ Done ]") @@ -130,12 +153,12 @@ push-multiarch-dev-on-debian: .PHONY: push-multiarch-on-debian push-multiarch-on-debian: @$(call func_echo_status, "$@ -> [ Start ]") - cp ./utils/check_standalone_config.sh debian/check_standalone_config.sh + cp ./utils/*.sh debian/ $(ENV_DOCKER) buildx build --network=host --push \ -t $(ENV_APISIX_IMAGE_TAG_NAME)-debian \ --platform linux/amd64,linux/arm64 \ -f ./debian/Dockerfile debian - rm -f debian/check_standalone_config.sh + rm -f debian/*.sh @$(call func_echo_success_status, "$@ -> [ Done ]") @@ -159,12 +182,12 @@ push-multiarch-on-redhat: push-multiarch-on-latest: @$(call func_echo_status, "$@ -> [ Start ]") @if [ "$(shell echo "$(APISIX_VERSION) $(MAX_APISIX_VERSION)" | tr " " "\n" | sort -rV | head -n 1)" == "$(APISIX_VERSION)" ]; then \ - cp ./utils/check_standalone_config.sh debian/check_standalone_config.sh; \ + cp ./utils/*.sh ubuntu/; \ $(ENV_DOCKER) buildx build --network=host --push \ -t $(IMAGE_NAME):latest \ --platform linux/amd64,linux/arm64 \ - -f ./debian/Dockerfile debian; \ - rm -f debian/check_standalone_config.sh; \ + -f ./ubuntu/Dockerfile ubuntu; \ + rm -f ubuntu/*.sh; \ fi @$(call func_echo_success_status, "$@ -> [ Done ]") diff --git a/ubuntu/Dockerfile b/ubuntu/Dockerfile new file mode 100644 index 0000000..33951b4 --- /dev/null +++ b/ubuntu/Dockerfile @@ -0,0 +1,74 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +FROM ubuntu:24.04 + +ARG APISIX_VERSION=3.13.0 + +RUN set -ex; \ + arch=$(dpkg --print-architecture); \ + apt update; \ + apt-get -y install --no-install-recommends wget gnupg ca-certificates curl;\ + . /etc/os-release; \ + case "${arch}" in \ + amd64) \ + wget -O - https://repos.apiseven.com/pubkey.gpg | apt-key add - \ + && echo "deb https://repos.apiseven.com/packages/ubuntu $VERSION_CODENAME main" | tee /etc/apt/sources.list.d/apisix.list \ + ;; \ + arm64) \ + wget -O - https://repos.apiseven.com/pubkey.gpg | apt-key add - \ + && echo "deb https://repos.apiseven.com/packages/arm64/ubuntu $VERSION_CODENAME main" | tee /etc/apt/sources.list.d/apisix.list \ + ;; \ + esac; \ + apt update \ + && apt install -y apisix=${APISIX_VERSION}-0 \ + && apt-get purge -y --auto-remove \ + && rm /usr/local/openresty/bin/etcdctl \ + && openresty -V \ + && apisix version + +COPY ./install-brotli.sh /install-brotli.sh +RUN chmod +x /install-brotli.sh \ + && cd / && ./install-brotli.sh && rm -rf /install-brotli.sh + +RUN apt-get -y purge --auto-remove curl wget gnupg --allow-remove-essential + +WORKDIR /usr/local/apisix + +ENV PATH=$PATH:/usr/local/openresty/luajit/bin:/usr/local/openresty/nginx/sbin:/usr/local/openresty/bin + +RUN groupadd --system --gid 636 apisix \ + && useradd --system --gid apisix --no-create-home --shell /usr/sbin/nologin --uid 636 apisix \ + && chown -R apisix:apisix /usr/local/apisix + +USER apisix + +# forward request and error logs to docker log collector +RUN ln -sf /dev/stdout /usr/local/apisix/logs/access.log \ + && ln -sf /dev/stderr /usr/local/apisix/logs/error.log + +EXPOSE 9080 9443 + +COPY ./docker-entrypoint.sh /docker-entrypoint.sh +COPY ./check_standalone_config.sh /check_standalone_config.sh + +ENTRYPOINT ["/docker-entrypoint.sh"] + +CMD ["docker-start"] + + +STOPSIGNAL SIGQUIT diff --git a/debian/docker-entrypoint.sh b/utils/docker-entrypoint.sh similarity index 100% rename from debian/docker-entrypoint.sh rename to utils/docker-entrypoint.sh diff --git a/debian/install-brotli.sh b/utils/install-brotli.sh similarity index 100% rename from debian/install-brotli.sh rename to utils/install-brotli.sh