Skip to content

Commit 77a0b16

Browse files
authored
feat: build apisix docker image for ubuntu 24.04 (#597)
Signed-off-by: Nic <qianyong@api7.ai>
1 parent 023183f commit 77a0b16

File tree

5 files changed

+110
-12
lines changed

5 files changed

+110
-12
lines changed

.github/workflows/apisix_push_docker_hub.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ jobs:
1010
fail-fast: false
1111
matrix:
1212
platform:
13+
- ubuntu
1314
- debian
1415
- redhat
1516
env:
@@ -61,7 +62,7 @@ jobs:
6162
uses: docker/setup-buildx-action@v1
6263

6364
- name: push apisix:latest image to docker hub
64-
if: matrix.platform == 'debian'
65+
if: matrix.platform == 'ubuntu'
6566
run: |
6667
make push-multiarch-on-latest
6768

Makefile

Lines changed: 34 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,9 @@ build-on-redhat:
8484
.PHONY: build-on-debian-dev
8585
build-on-debian-dev:
8686
@$(call func_echo_status, "$@ -> [ Start ]")
87-
cp ./utils/check_standalone_config.sh debian-dev/check_standalone_config.sh
87+
cp ./utils/*.sh debian-dev/
8888
$(ENV_DOCKER) build -t $(ENV_APISIX_IMAGE_TAG_NAME)-debian-dev -f ./debian-dev/Dockerfile debian-dev
89-
rm -f debian-dev/check_standalone_config.sh
89+
rm -f debian-dev/*.sh
9090
@$(call func_echo_success_status, "$@ -> [ Done ]")
9191

9292
### build-on-debian-local-dev : Build apache/apisix:xx-debian-dev image
@@ -103,39 +103,62 @@ else
103103
endif
104104
@$(call func_echo_success_status, "$@ -> [ Done ]")
105105

106+
107+
### build-on-ubuntu : Build apache/apisix:xx-ubuntu image
108+
.PHONY: build-on-ubuntu
109+
build-on-ubuntu:
110+
@$(call func_echo_status, "$@ -> [ Start ]")
111+
cp ./utils/*.sh ubuntu/
112+
$(ENV_DOCKER) build -t $(ENV_APISIX_IMAGE_TAG_NAME)-ubuntu -f ./ubuntu/Dockerfile ubuntu
113+
rm -f ubuntu/*.sh
114+
@$(call func_echo_success_status, "$@ -> [ Done ]")
115+
106116
### build-on-debian : Build apache/apisix:xx-debian image
107117
.PHONY: build-on-debian
108118
build-on-debian:
109119
@$(call func_echo_status, "$@ -> [ Start ]")
110-
cp ./utils/check_standalone_config.sh debian/check_standalone_config.sh
120+
cp ./utils/*.sh debian/
111121
$(ENV_DOCKER) build -t $(ENV_APISIX_IMAGE_TAG_NAME)-debian -f ./debian/Dockerfile debian
112-
rm -f debian/check_standalone_config.sh
122+
rm -f debian/*.sh
113123
@$(call func_echo_success_status, "$@ -> [ Done ]")
114124

115125

116126
### push-on-alpine : Push apache/apisix:dev image
117127
.PHONY: push-multiarch-dev-on-debian
118128
push-multiarch-dev-on-debian:
119129
@$(call func_echo_status, "$@ -> [ Start ]")
120-
cp ./utils/check_standalone_config.sh debian-dev/check_standalone_config.sh
130+
cp ./utils/*.sh debian-dev/
121131
$(ENV_DOCKER) buildx build --network=host --push \
122132
-t $(IMAGE_NAME):dev \
123133
--platform linux/amd64,linux/arm64 \
124134
-f ./debian-dev/Dockerfile debian-dev
125-
rm -f debian-dev/check_standalone_config.sh
135+
rm -f debian-dev/*.sh
136+
@$(call func_echo_success_status, "$@ -> [ Done ]")
137+
138+
139+
### push-multiarch-on-ubuntu : Push apache/apisix:xx-ubuntu image
140+
.PHONY: push-multiarch-on-ubuntu
141+
push-multiarch-on-ubuntu:
142+
@$(call func_echo_status, "$@ -> [ Start ]")
143+
cp ./utils/*.sh ubuntu/
144+
$(ENV_DOCKER) buildx build --network=host --push \
145+
-t $(ENV_APISIX_IMAGE_TAG_NAME)-ubuntu \
146+
--platform linux/amd64,linux/arm64 \
147+
-f ./ubuntu/Dockerfile ubuntu
148+
rm -f ubuntu/*.sh
126149
@$(call func_echo_success_status, "$@ -> [ Done ]")
127150

128151

129152
### push-multiarch-on-debian : Push apache/apisix:xx-debian image
130153
.PHONY: push-multiarch-on-debian
131154
push-multiarch-on-debian:
132155
@$(call func_echo_status, "$@ -> [ Start ]")
133-
cp ./utils/check_standalone_config.sh debian/check_standalone_config.sh
156+
cp ./utils/*.sh debian/
134157
$(ENV_DOCKER) buildx build --network=host --push \
135158
-t $(ENV_APISIX_IMAGE_TAG_NAME)-debian \
136159
--platform linux/amd64,linux/arm64 \
137160
-f ./debian/Dockerfile debian
138-
rm -f debian/check_standalone_config.sh
161+
rm -f debian/*.sh
139162
@$(call func_echo_success_status, "$@ -> [ Done ]")
140163

141164

@@ -159,12 +182,12 @@ push-multiarch-on-redhat:
159182
push-multiarch-on-latest:
160183
@$(call func_echo_status, "$@ -> [ Start ]")
161184
@if [ "$(shell echo "$(APISIX_VERSION) $(MAX_APISIX_VERSION)" | tr " " "\n" | sort -rV | head -n 1)" == "$(APISIX_VERSION)" ]; then \
162-
cp ./utils/check_standalone_config.sh debian/check_standalone_config.sh; \
185+
cp ./utils/*.sh ubuntu/; \
163186
$(ENV_DOCKER) buildx build --network=host --push \
164187
-t $(IMAGE_NAME):latest \
165188
--platform linux/amd64,linux/arm64 \
166-
-f ./debian/Dockerfile debian; \
167-
rm -f debian/check_standalone_config.sh; \
189+
-f ./ubuntu/Dockerfile ubuntu; \
190+
rm -f ubuntu/*.sh; \
168191
fi
169192
@$(call func_echo_success_status, "$@ -> [ Done ]")
170193

ubuntu/Dockerfile

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
#
2+
# Licensed to the Apache Software Foundation (ASF) under one or more
3+
# contributor license agreements. See the NOTICE file distributed with
4+
# this work for additional information regarding copyright ownership.
5+
# The ASF licenses this file to You under the Apache License, Version 2.0
6+
# (the "License"); you may not use this file except in compliance with
7+
# the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
#
17+
18+
FROM ubuntu:24.04
19+
20+
ARG APISIX_VERSION=3.13.0
21+
22+
RUN set -ex; \
23+
arch=$(dpkg --print-architecture); \
24+
apt update; \
25+
apt-get -y install --no-install-recommends wget gnupg ca-certificates curl;\
26+
. /etc/os-release; \
27+
case "${arch}" in \
28+
amd64) \
29+
wget -O - https://repos.apiseven.com/pubkey.gpg | apt-key add - \
30+
&& echo "deb https://repos.apiseven.com/packages/ubuntu $VERSION_CODENAME main" | tee /etc/apt/sources.list.d/apisix.list \
31+
;; \
32+
arm64) \
33+
wget -O - https://repos.apiseven.com/pubkey.gpg | apt-key add - \
34+
&& echo "deb https://repos.apiseven.com/packages/arm64/ubuntu $VERSION_CODENAME main" | tee /etc/apt/sources.list.d/apisix.list \
35+
;; \
36+
esac; \
37+
apt update \
38+
&& apt install -y apisix=${APISIX_VERSION}-0 \
39+
&& apt-get purge -y --auto-remove \
40+
&& rm /usr/local/openresty/bin/etcdctl \
41+
&& openresty -V \
42+
&& apisix version
43+
44+
COPY ./install-brotli.sh /install-brotli.sh
45+
RUN chmod +x /install-brotli.sh \
46+
&& cd / && ./install-brotli.sh && rm -rf /install-brotli.sh
47+
48+
RUN apt-get -y purge --auto-remove curl wget gnupg --allow-remove-essential
49+
50+
WORKDIR /usr/local/apisix
51+
52+
ENV PATH=$PATH:/usr/local/openresty/luajit/bin:/usr/local/openresty/nginx/sbin:/usr/local/openresty/bin
53+
54+
RUN groupadd --system --gid 636 apisix \
55+
&& useradd --system --gid apisix --no-create-home --shell /usr/sbin/nologin --uid 636 apisix \
56+
&& chown -R apisix:apisix /usr/local/apisix
57+
58+
USER apisix
59+
60+
# forward request and error logs to docker log collector
61+
RUN ln -sf /dev/stdout /usr/local/apisix/logs/access.log \
62+
&& ln -sf /dev/stderr /usr/local/apisix/logs/error.log
63+
64+
EXPOSE 9080 9443
65+
66+
COPY ./docker-entrypoint.sh /docker-entrypoint.sh
67+
COPY ./check_standalone_config.sh /check_standalone_config.sh
68+
69+
ENTRYPOINT ["/docker-entrypoint.sh"]
70+
71+
CMD ["docker-start"]
72+
73+
74+
STOPSIGNAL SIGQUIT
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)