Dockerfile 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. ARG ENABLE_PROXY=false
  2. FROM api7/apisix-base:1.19.3.2.2 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. openldap-dev \
  18. && cd apisix \
  19. && make deps \
  20. && cp -v bin/apisix /usr/bin/ \
  21. && mv ../apisix /usr/local/apisix \
  22. && apk del .builddeps build-base make unzip
  23. FROM alpine:3.13 AS last-stage
  24. ARG ENABLE_PROXY
  25. # add runtime for Apache APISIX
  26. RUN set -x \
  27. && (test "${ENABLE_PROXY}" != "true" || /bin/sed -i 's,http://dl-cdn.alpinelinux.org,https://mirrors.aliyun.com,g' /etc/apk/repositories) \
  28. && apk add --no-cache bash libstdc++ curl tzdata openldap-dev
  29. WORKDIR /usr/local/apisix
  30. COPY --from=production-stage /usr/local/openresty/ /usr/local/openresty/
  31. COPY --from=production-stage /usr/local/apisix/ /usr/local/apisix/
  32. COPY --from=production-stage /usr/bin/apisix /usr/bin/apisix
  33. # forward request and error logs to docker log collector
  34. RUN mkdir -p logs && touch logs/access.log && touch logs/error.log \
  35. && ln -sf /dev/stdout /usr/local/apisix/logs/access.log \
  36. && ln -sf /dev/stderr /usr/local/apisix/logs/error.log
  37. ENV PATH=$PATH:/usr/local/openresty/luajit/bin:/usr/local/openresty/nginx/sbin:/usr/local/openresty/bin
  38. EXPOSE 9080 9443
  39. CMD ["sh", "-c", "/usr/bin/apisix init && /usr/bin/apisix init_etcd && /usr/local/openresty/bin/openresty -p /usr/local/apisix -g 'daemon off;'"]
  40. STOPSIGNAL SIGQUIT