You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by al...@apache.org on 2024/01/15 06:37:49 UTC
(apisix-docker) branch master updated: fix: apisix-debian-dev image failed to run (#537)
This is an automated email from the ASF dual-hosted git repository.
alinsran 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 b078233 fix: apisix-debian-dev image failed to run (#537)
b078233 is described below
commit b0782330be5eb4578efacbd17eda2fa300f5db8f
Author: AlinsRan <al...@apache.org>
AuthorDate: Mon Jan 15 14:37:44 2024 +0800
fix: apisix-debian-dev image failed to run (#537)
---
.../workflows/apisix_dev_docker_local_test.yaml | 8 ++-
Makefile | 22 +++++++
debian-dev/Dockerfile.local | 75 ++++++++--------------
debian-dev/docker-entrypoint.sh | 4 ++
4 files changed, 57 insertions(+), 52 deletions(-)
diff --git a/.github/workflows/apisix_dev_docker_local_test.yaml b/.github/workflows/apisix_dev_docker_local_test.yaml
index 0a488b5..ca8f58d 100644
--- a/.github/workflows/apisix_dev_docker_local_test.yaml
+++ b/.github/workflows/apisix_dev_docker_local_test.yaml
@@ -14,7 +14,8 @@ on:
- 'release/apisix-2.15.**'
env:
- APISIX_IMAGE_TAG: "local"
+ APISIX_IMAGE_TAG: "local-debian-dev"
+ APISIX_VERSION: "local"
jobs:
@@ -35,9 +36,10 @@ jobs:
git clone https://github.com/apache/apisix.git
- name: Build image
+ env:
+ LOCAL_CODE_PATH: ./apisix
run: |
- tag="apache/apisix:$APISIX_IMAGE_TAG"
- docker build -t $tag -f debian-dev/Dockerfile.local .
+ make build-on-debian-local-dev
- name: use docker-compose
run: docker-compose -p docker-apisix -f example/docker-compose.yml up -d
diff --git a/Makefile b/Makefile
index c3de388..ed9cb92 100644
--- a/Makefile
+++ b/Makefile
@@ -25,6 +25,9 @@ APISIX_VERSION ?= 3.7.0
MAX_APISIX_VERSION ?= 3.7.0
IMAGE_NAME = apache/apisix
IMAGE_TAR_NAME = apache_apisix
+APISIX_REPO = https://github.com/apache/apisix
+APISIX_REPO_BRANCH = master
+LOCAL_CODE_PATH = 0
APISIX_DASHBOARD_VERSION ?= $(shell echo ${APISIX_DASHBOARD_VERSION:=3.0.1})
APISIX_DASHBOARD_IMAGE_NAME = apache/apisix-dashboard
@@ -60,6 +63,12 @@ define func_echo_success_status
printf "[$(_color_green) info $(_color_wipe)] %s\n" $(1)
endef
+define build_image_dev
+ $(ENV_DOCKER) build -t $(ENV_APISIX_IMAGE_TAG_NAME)-debian-dev \
+ --build-arg CODE_PATH=$(1) \
+ --build-arg ENTRYPOINT_PATH=debian-dev/docker-entrypoint.sh \
+ -f ./debian-dev/Dockerfile.local .
+endef
### build-on-redhat : Build apache/apisix:xx-redhat image
.PHONY: build-on-redhat
@@ -75,6 +84,19 @@ build-on-debian-dev:
$(ENV_DOCKER) build -t $(ENV_APISIX_IMAGE_TAG_NAME)-debian-dev -f ./debian-dev/Dockerfile debian-dev
@$(call func_echo_success_status, "$@ -> [ Done ]")
+### build-on-debian-local-dev : Build apache/apisix:xx-debian-dev image
+.PHONY: build-on-debian-local-dev
+build-on-debian-local-dev:
+ @$(call func_echo_status, "$@ -> [ Start ]")
+ifeq ($(LOCAL_CODE_PATH), 0)
+ifeq ($(shell test -d ./apisix && echo -n yes), )
+ git clone -b $(APISIX_REPO_BRANCH) $(APISIX_REPO) ./apisix
+endif
+ $(call build_image_dev,"./apisix")
+else
+ $(call build_image_dev,$(LOCAL_CODE_PATH))
+endif
+ @$(call func_echo_success_status, "$@ -> [ Done ]")
### build-on-debian : Build apache/apisix:xx-debian image
.PHONY: build-on-debian
diff --git a/debian-dev/Dockerfile.local b/debian-dev/Dockerfile.local
index 0ff3ea4..ac5b105 100644
--- a/debian-dev/Dockerfile.local
+++ b/debian-dev/Dockerfile.local
@@ -17,71 +17,48 @@
# Use this dockerfile to create a docker image of your apisix local/patched codebase
-FROM api7/apisix-runtime:dev AS build
+FROM debian:bullseye-slim AS build
ARG ENABLE_PROXY=false
+ARG CODE_PATH
ENV DEBIAN_FRONTEND noninteractive
+ENV ENV_INST_LUADIR /usr/local/apisix
-# replace the source path with the location of apisix related directories in your host machine
-# refer: https://web.archive.org/web/20230604150902/https://www.jamestharpe.com/docker-include-files-outside-build-context/
+COPY ${CODE_PATH} /apisix
-COPY apisix/apisix /usr/local/apisix/apisix
-COPY apisix/conf /usr/local/apisix/conf
-COPY apisix/bin/apisix /usr/bin/apisix
-COPY apisix/apisix-master-0.rockspec /usr/local/apisix/apisix-master-0.rockspec
-COPY apisix/utils/linux-install-luarocks.sh /usr/local/apisix/linux-install-luarocks.sh
-COPY debian-dev/docker-entrypoint.sh /docker-entrypoint.sh
+WORKDIR /apisix
+RUN set -x \
+ && apt-get -y update --fix-missing \
+ && apt-get install -y \
+ make \
+ git \
+ sudo \
+ && ls -al \
+ && make deps \
+ && mkdir -p ${ENV_INST_LUADIR} \
+ && cp -r deps ${ENV_INST_LUADIR} \
+ && make install
-WORKDIR /usr/local/apisix
+FROM debian:bullseye-slim
-SHELL ["/bin/bash", "-c"]
+ARG ENTRYPOINT_PATH=./docker-entrypoint.sh
-RUN set -x \
- && DEBIAN_FRONTEND=noninteractive apt-get update \
- && DEBIAN_FRONTEND=noninteractive apt-get install -y libreadline-dev lsb-release libpcre3 libpcre3-dev libldap2-dev libssl-dev perl build-essential \
- && DEBIAN_FRONTEND=noninteractive apt-get -y install --no-install-recommends wget gnupg ca-certificates
+COPY --from=build /usr/local/apisix /usr/local/apisix
+COPY --from=build /usr/local/openresty /usr/local/openresty
+COPY --from=build /usr/bin/apisix /usr/bin/apisix
-RUN set -x \
- && wget -O - https://openresty.org/package/pubkey.gpg | apt-key add - \
- && wget -O - http://repos.apiseven.com/pubkey.gpg | apt-key add - \
- && echo "deb http://openresty.org/package/debian bullseye openresty" | tee /etc/apt/sources.list.d/openresty.list \
- && echo "deb http://repos.apiseven.com/packages/debian bullseye main" | tee /etc/apt/sources.list.d/apisix.list \
- && DEBIAN_FRONTEND=noninteractive apt-get update \
- && DEBIAN_FRONTEND=noninteractive apt-get install -y apisix-runtime
+ENV PATH=$PATH:/usr/local/openresty/luajit/bin:/usr/local/openresty/nginx/sbin:/usr/local/openresty/bin
-RUN set -x \
- && (test "${ENABLE_PROXY}" != "true" || /bin/sed -i 's,http://deb.debian.org,http://mirrors.aliyun.com,g' /etc/apt/sources.list) \
- && apt-get -y update --fix-missing \
- && apt-get install -y curl \
- gawk \
- git \
- libldap2-dev \
- liblua5.1-0-dev \
- lua5.1 \
- sudo \
- unzip \
- wget \
- make \
- libssl-dev \
- && curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y \
- && source "$HOME/.cargo/env" \
- # rust version 1.69.0 required to compile lua-resty-ldap
- && rustup install 1.69.0 \
- && rustup default 1.69.0 \
- && bash ./linux-install-luarocks.sh \
- && luarocks config variables.OPENSSL_INCDIR /usr/include/ \
- && luarocks config variables.PCRE_DIR /usr/local/openresty/pcre \
- && luarocks install apisix-master-0.rockspec --tree=/usr/local/apisix/deps --deps-only \
- && mkdir /usr/local/apisix/logs && touch /usr/local/apisix/logs/error.log && touch /usr/local/apisix/logs/access.log
+WORKDIR /usr/local/apisix
-ENV PATH=$PATH:/usr/local/openresty/luajit/bin:/usr/local/openresty/nginx/sbin:/usr/local/openresty/bin
+RUN ln -sf /dev/stdout /usr/local/apisix/logs/access.log \
+ && ln -sf /dev/stderr /usr/local/apisix/logs/error.log
EXPOSE 9080 9443
-
-RUN ["chmod", "+x", "/docker-entrypoint.sh"]
+COPY ${ENTRYPOINT_PATH} /docker-entrypoint.sh
ENTRYPOINT ["/docker-entrypoint.sh"]
diff --git a/debian-dev/docker-entrypoint.sh b/debian-dev/docker-entrypoint.sh
index f718502..56b2566 100755
--- a/debian-dev/docker-entrypoint.sh
+++ b/debian-dev/docker-entrypoint.sh
@@ -56,6 +56,10 @@ _EOC_
rm -f "/usr/local/apisix/conf/config_listen.sock"
fi
+ if [ -e "/usr/local/apisix/logs/worker_events.sock" ]; then
+ rm -f "/usr/local/apisix/logs/worker_events.sock"
+ fi
+
exec /usr/local/openresty/bin/openresty -p /usr/local/apisix -g 'daemon off;'
fi