Dockerfile 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. ARG ENABLE_PROXY=false
  2. FROM api7/apisix-base:1.19.3.2.2 AS production-stage
  3. ARG ENABLE_PROXY
  4. RUN set -x \
  5. && (test "${ENABLE_PROXY}" != "true" || /bin/sed -i 's,http://dl-cdn.alpinelinux.org,https://mirrors.aliyun.com,g' /etc/apk/repositories) \
  6. && apk add --no-cache --virtual .builddeps \
  7. automake \
  8. autoconf \
  9. libtool \
  10. pkgconfig \
  11. cmake \
  12. git \
  13. pcre \
  14. pcre-dev \
  15. openldap-dev \
  16. && luarocks install https://github.com/apache/apisix/raw/master/rockspec/apisix-master-0.rockspec --tree=/usr/local/apisix/deps \
  17. && cp -v /usr/local/apisix/deps/lib/luarocks/rocks-5.1/apisix/master-0/bin/apisix /usr/bin/ \
  18. && mv /usr/local/apisix/deps/share/lua/5.1/apisix /usr/local/apisix \
  19. && apk del .builddeps build-base make unzip
  20. FROM alpine:3.13 AS last-stage
  21. ARG ENABLE_PROXY
  22. # add runtime for Apache APISIX
  23. RUN set -x \
  24. && (test "${ENABLE_PROXY}" != "true" || /bin/sed -i 's,http://dl-cdn.alpinelinux.org,https://mirrors.aliyun.com,g' /etc/apk/repositories) \
  25. && apk add --no-cache bash libstdc++ curl tzdata openldap-dev
  26. WORKDIR /usr/local/apisix
  27. COPY --from=production-stage /usr/local/openresty/ /usr/local/openresty/
  28. COPY --from=production-stage /usr/local/apisix/ /usr/local/apisix/
  29. COPY --from=production-stage /usr/bin/apisix /usr/bin/apisix
  30. # forward request and error logs to docker log collector
  31. RUN ln -sf /dev/stdout /usr/local/apisix/logs/access.log \
  32. && ln -sf /dev/stderr /usr/local/apisix/logs/error.log
  33. ENV PATH=$PATH:/usr/local/openresty/luajit/bin:/usr/local/openresty/nginx/sbin:/usr/local/openresty/bin
  34. EXPOSE 9080 9443
  35. CMD ["sh", "-c", "/usr/bin/apisix init && /usr/bin/apisix init_etcd && /usr/local/openresty/bin/openresty -p /usr/local/apisix -g 'daemon off;'"]
  36. STOPSIGNAL SIGQUIT