diff --git a/dockerfiles/Dockerfile.apisix-base.deb b/dockerfiles/Dockerfile.apisix-base.deb index 56845a106..ef4603dc5 100644 --- a/dockerfiles/Dockerfile.apisix-base.deb +++ b/dockerfiles/Dockerfile.apisix-base.deb @@ -1,7 +1,7 @@ -ARG IMAGE_BASE="ubuntu" -ARG IMAGE_TAG="20.04" +ARG IMAGE_BASE="debian" +ARG IMAGE_TAG="bullseye-slim" -FROM ${IMAGE_BASE}:${IMAGE_TAG} +FROM ${IMAGE_BASE}:${IMAGE_TAG} as build COPY ./utils/build-common.sh /tmp/build-common.sh COPY build-apisix-base.sh /tmp/build-apisix-base.sh @@ -22,3 +22,8 @@ ENV build_latest=${BUILD_LATEST:-} RUN ./build-common.sh build_apisix_base_deb ${build_latest} \ # determine dist and write it into /tmp/dist file && /tmp/determine-dist.sh + +FROM ${IMAGE_BASE}:${IMAGE_TAG} as prod + +COPY --from=build /usr/local /usr/local +COPY --from=build /tmp/dist /tmp/dist diff --git a/utils/build-common.sh b/utils/build-common.sh index 4030e6602..b6147b9fc 100755 --- a/utils/build-common.sh +++ b/utils/build-common.sh @@ -39,12 +39,19 @@ build_apisix_base_deb() { DEBIAN_FRONTEND=noninteractive apt-get install -y sudo git libreadline-dev lsb-release libssl-dev perl build-essential DEBIAN_FRONTEND=noninteractive apt-get -y install --no-install-recommends wget gnupg ca-certificates wget -O - https://openresty.org/package/pubkey.gpg | apt-key add - - echo "deb http://openresty.org/package/${arch_path}ubuntu $(lsb_release -sc) main" | tee /etc/apt/sources.list.d/openresty.list + + if [[ $IMAGE_BASE == "ubuntu" ]]; then + echo "deb http://openresty.org/package/${arch_path}ubuntu $(lsb_release -sc) main" | tee /etc/apt/sources.list.d/openresty.list + fi + + if [[ $IMAGE_BASE == "debian" ]]; then + echo "deb http://openresty.org/package/${arch_path}debian $(lsb_release -sc) openresty" | tee /etc/apt/sources.list.d/openresty.list + fi + DEBIAN_FRONTEND=noninteractive apt-get update DEBIAN_FRONTEND=noninteractive apt-get install -y openresty-openssl111-dev openresty-pcre-dev openresty-zlib-dev export_openresty_variables - # fix OR_PREFIX if [[ $build_latest == "latest" ]]; then unset OR_PREFIX