ARG ENABLE_PROXY=false FROM openresty/openresty:1.19.3.1-alpine-fat AS production-stage ARG APISIX_VERSION=2.9 LABEL apisix_version="${APISIX_VERSION}" ARG ENABLE_PROXY RUN set -x \ && (test "${ENABLE_PROXY}" != "true" || /bin/sed -i 's,http://dl-cdn.alpinelinux.org,https://mirrors.aliyun.com,g' /etc/apk/repositories) \ && apk add --no-cache --virtual .builddeps \ automake \ autoconf \ libtool \ pkgconfig \ cmake \ git \ pcre \ pcre-dev \ && mkdir ~/.luarocks \ && luarocks config variables.OPENSSL_LIBDIR /usr/local/openresty/openssl/lib \ && luarocks config variables.OPENSSL_INCDIR /usr/local/openresty/openssl/include \ && luarocks install https://github.com/apache/apisix/raw/master/rockspec/apisix-${APISIX_VERSION}-0.rockspec --tree=/usr/local/apisix/deps \ && cp -v /usr/local/apisix/deps/lib/luarocks/rocks-5.1/apisix/${APISIX_VERSION}-0/bin/apisix /usr/bin/ \ && (if [ "$APISIX_VERSION" = "master" ] || [ "$APISIX_VERSION" \> "2.2" ]; then echo 'use shell ';else bin='#! /usr/local/openresty/luajit/bin/luajit\npackage.path = "/usr/local/apisix/?.lua;" .. package.path'; sed -i "1s@.*@$bin@" /usr/bin/apisix ; fi;) \ && mv /usr/local/apisix/deps/share/lua/5.1/apisix /usr/local/apisix \ && apk del .builddeps build-base make unzip FROM alpine:3.13 AS last-stage ARG ENABLE_PROXY # add runtime for Apache APISIX RUN set -x \ && (test "${ENABLE_PROXY}" != "true" || /bin/sed -i 's,http://dl-cdn.alpinelinux.org,https://mirrors.aliyun.com,g' /etc/apk/repositories) \ && apk add --no-cache bash libstdc++ curl tzdata WORKDIR /usr/local/apisix COPY --from=production-stage /usr/local/openresty/ /usr/local/openresty/ COPY --from=production-stage /usr/local/apisix/ /usr/local/apisix/ COPY --from=production-stage /usr/bin/apisix /usr/bin/apisix # forward request and error logs to docker log collector RUN ln -sf /dev/stdout /usr/local/apisix/logs/access.log \ && ln -sf /dev/stderr /usr/local/apisix/logs/error.log ENV PATH=$PATH:/usr/local/openresty/luajit/bin:/usr/local/openresty/nginx/sbin:/usr/local/openresty/bin EXPOSE 9080 9443 CMD ["sh", "-c", "/usr/bin/apisix init && /usr/bin/apisix init_etcd && /usr/local/openresty/bin/openresty -p /usr/local/apisix -g 'daemon off;'"] STOPSIGNAL SIGQUIT