11ARG IMAGE_BASE="alpine"
2- ARG IMAGE_TAG="3.12 "
2+ ARG IMAGE_TAG="3.14 "
33
4- FROM ${IMAGE_BASE}:${IMAGE_TAG}
4+ FROM ${IMAGE_BASE}:${IMAGE_TAG} as build
55
6- COPY ./utils/build-common.sh /tmp/build-common.sh
7- COPY ./utils/install-common.sh /tmp/install-common.sh
8- COPY build-apisix-base.sh /tmp/build-apisix-base.sh
9- COPY ./utils/determine-dist.sh /tmp/determine-dist.sh
6+ COPY ./utils/build-common.sh \
7+ ./utils/install-common.sh \
8+ build-apisix-base.sh \
9+ ./utils/determine-dist.sh \
10+ /tmp/
1011
1112
1213ARG RESTY_OPENSSL_VERSION="1.1.1g"
@@ -28,36 +29,30 @@ LABEL resty_eval_pre_configure="${RESTY_EVAL_PRE_CONFIGURE}"
2829
2930ENV PATH=$PATH:/usr/local/openresty/luajit/bin:/usr/local/openresty/nginx/sbin:/usr/local/openresty/bin
3031
31- RUN apk add --no-cache --virtual .build-deps \
32+ RUN apk add --no-cache \
3233 build-base \
3334 coreutils \
3435 curl \
36+ gd \
3537 gd-dev \
38+ geoip \
3639 geoip-dev \
40+ libxslt \
3741 libxslt-dev \
3842 linux-headers \
3943 make \
4044 perl-dev \
4145 readline-dev \
46+ zlib \
4247 zlib-dev \
4348 unzip \
44- && apk add --no-cache \
45- gd \
46- geoip \
47- libxslt \
48- zlib \
49- bash \
5049 git \
5150 sudo \
52- curl \
53- build-base \
51+ bash \
5452 libstdc++
5553
5654# install latest Rust to build wasmtime
57- RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs > rust-installer.sh \
58- && chmod +x ./rust-installer.sh \
59- && ./rust-installer.sh -y \
60- && rm rust-installer.sh
55+ RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
6156
6257RUN cd /tmp \
6358 && if [ -n "${RESTY_EVAL_PRE_CONFIGURE}" ]; then eval $(echo ${RESTY_EVAL_PRE_CONFIGURE}); fi \
@@ -98,4 +93,20 @@ RUN cd /tmp \
9893 && ./install-common.sh install_luarocks \
9994 && /usr/local/openresty/bin/openresty -V
10095
96+
97+ FROM ${IMAGE_BASE}:${IMAGE_TAG} as prod
98+
99+ COPY --from=build /usr/local/openresty /usr/local/openresty
100+
101+ RUN apk add --no-cache \
102+ gd \
103+ geoip \
104+ libxslt \
105+ zlib \
106+ libstdc++ \
107+ && rm /usr/local/openresty/wasmtime-c-api/lib/libwasmtime.a \
108+ && rm /usr/local/openresty/wasmtime-c-api/lib/libwasmtime.d
109+
110+ ENV PATH=$PATH:/usr/local/openresty/luajit/bin:/usr/local/openresty/nginx/sbin:/usr/local/openresty/bin
111+
101112CMD /bin/sh
0 commit comments