Dockerfile 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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. FROM api7/apisix-base:dev AS build
  18. ARG ENABLE_PROXY=false
  19. ENV DEBIAN_FRONTEND noninteractive
  20. RUN set -x \
  21. && (test "${ENABLE_PROXY}" != "true" || /bin/sed -i 's,http://deb.debian.org,https://mirrors.aliyun.com,g' /etc/apt/sources.list) \
  22. && apt-get -y update --fix-missing \
  23. && apt-get install -y curl \
  24. gawk \
  25. git \
  26. libldap2-dev \
  27. liblua5.1-0-dev \
  28. lua5.1 \
  29. make \
  30. sudo \
  31. unzip \
  32. wget \
  33. rustc \
  34. && curl https://raw.githubusercontent.com/apache/apisix/master/utils/linux-install-luarocks.sh -sL | bash - \
  35. && luarocks install https://github.com/apache/apisix/raw/master/rockspec/apisix-master-0.rockspec --tree=/usr/local/apisix/deps PCRE_DIR=/usr/local/openresty/pcre \
  36. && cp -v /usr/local/apisix/deps/lib/luarocks/rocks-5.1/apisix/master-0/bin/apisix /usr/bin/ \
  37. && mv /usr/local/apisix/deps/share/lua/5.1/apisix /usr/local/apisix \
  38. # forward request and error logs to docker log collector
  39. && ln -sf /dev/stdout /usr/local/apisix/logs/access.log \
  40. && ln -sf /dev/stderr /usr/local/apisix/logs/error.log
  41. FROM api7/apisix-base:dev AS production-stage
  42. COPY --from=build /usr/local/apisix /usr/local/apisix
  43. COPY --from=build /usr/bin/apisix /usr/bin/apisix
  44. ENV DEBIAN_FRONTEND noninteractive
  45. RUN apt-get -y update --fix-missing \
  46. && apt-get install -y \
  47. libldap2-dev \
  48. && apt-get remove --purge --auto-remove -y
  49. WORKDIR /usr/local/apisix
  50. ENV PATH=$PATH:/usr/local/openresty-debug/luajit/bin:/usr/local/openresty-debug/nginx/sbin:/usr/local/openresty-debug/bin
  51. EXPOSE 9080 9443
  52. COPY ./docker-entrypoint.sh /docker-entrypoint.sh
  53. ENTRYPOINT ["/docker-entrypoint.sh"]
  54. CMD ["docker-start"]
  55. STOPSIGNAL SIGQUIT