Dockerfile 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. #
  2. # Licensed to the Apache Software Foundation (ASF) under one or more
  3. # contributor license agreements. See the NOTICE file distributed with
  4. # this work for additional information regarding copyright ownership.
  5. # The ASF licenses this file to You under the Apache License, Version 2.0
  6. # (the "License"); you may not use this file except in compliance with
  7. # the License. You may obtain a copy of the License at
  8. #
  9. # http://www.apache.org/licenses/LICENSE-2.0
  10. #
  11. # Unless required by applicable law or agreed to in writing, software
  12. # distributed under the License is distributed on an "AS IS" BASIS,
  13. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. # See the License for the specific language governing permissions and
  15. # limitations under the License.
  16. #
  17. ARG ENABLE_PROXY=false
  18. FROM api7/apisix-base:1.19.9.1.2 AS production-stage
  19. ARG ENABLE_PROXY
  20. RUN set -x \
  21. && (test "${ENABLE_PROXY}" != "true" || /bin/sed -i 's,http://dl-cdn.alpinelinux.org,https://mirrors.aliyun.com,g' /etc/apk/repositories) \
  22. && apk add --no-cache --virtual .builddeps \
  23. build-base \
  24. automake \
  25. autoconf \
  26. make \
  27. libtool \
  28. pkgconfig \
  29. cmake \
  30. unzip \
  31. curl \
  32. openssl \
  33. git \
  34. pcre \
  35. pcre-dev \
  36. openldap-dev \
  37. && luarocks install https://github.com/apache/apisix/raw/master/rockspec/apisix-master-0.rockspec --tree=/usr/local/apisix/deps \
  38. && cp -v /usr/local/apisix/deps/lib/luarocks/rocks-5.1/apisix/master-0/bin/apisix /usr/bin/ \
  39. && mv /usr/local/apisix/deps/share/lua/5.1/apisix /usr/local/apisix \
  40. && apk del .builddeps \
  41. && apk add --no-cache bash libstdc++ curl tzdata \
  42. # forward request and error logs to docker log collector
  43. && ln -sf /dev/stdout /usr/local/apisix/logs/access.log \
  44. && ln -sf /dev/stderr /usr/local/apisix/logs/error.log
  45. WORKDIR /usr/local/apisix
  46. ENV PATH=$PATH:/usr/local/openresty/luajit/bin:/usr/local/openresty/nginx/sbin:/usr/local/openresty/bin
  47. EXPOSE 9080 9443
  48. CMD ["sh", "-c", "/usr/bin/apisix init && /usr/bin/apisix init_etcd && /usr/local/openresty/bin/openresty -p /usr/local/apisix -g 'daemon off;'"]
  49. STOPSIGNAL SIGQUIT