Dockerfile 1.6 KB

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