Skip to content

Commit

Permalink
fix: use debian slim as base image (#209)
Browse files Browse the repository at this point in the history
* fix: use debain slim as base image

* fix CI

* reducing the size of the build product

* fix typo

* reduce

* reduce

* reduce

* reduce

* reduce

* reduce

* reduce

* reduce

* reduce

* reduce

* feat: use debian as base image and reduce images size

Signed-off-by: tzssangglass <[email protected]>

* fix COPY

Signed-off-by: tzssangglass <[email protected]>

* rm ENV

Signed-off-by: tzssangglass <[email protected]>

* fix COPY

Signed-off-by: tzssangglass <[email protected]>
  • Loading branch information
tzssangglass authored Jun 16, 2022
1 parent 812e3aa commit 0e70c70
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
11 changes: 8 additions & 3 deletions dockerfiles/Dockerfile.apisix-base.deb
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
11 changes: 9 additions & 2 deletions utils/build-common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 0e70c70

Please sign in to comment.