| ARG ENABLE_PROXY=false |
| |
| FROM openresty/openresty:1.19.3.1-alpine-fat AS production-stage |
| |
| ARG ENABLE_PROXY |
| ARG APISIX_PATH |
| COPY $APISIX_PATH ./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 --virtual .builddeps \ |
| automake \ |
| autoconf \ |
| libtool \ |
| pkgconfig \ |
| cmake \ |
| git \ |
| && cd apisix \ |
| && (i=0; while true; do if [[ "$i" -eq 10 ]]; then echo "failed to make deps in time"; exit 1; fi; make deps && break; i=$(( i + 1 )); done;) \ |
| && cp -v bin/apisix /usr/bin/ \ |
| && mv ../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 |
| |
| 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 |