Dockerfile 2.7 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 debian:bullseye-slim
  18. ARG APISIX_VERSION=3.4.0
  19. RUN set -ex; \
  20. arch=$(dpkg --print-architecture); \
  21. apt update; \
  22. apt-get -y install --no-install-recommends wget gnupg ca-certificates curl; \
  23. codename=`grep -Po 'VERSION="[0-9]+ \(\K[^)]+' /etc/os-release`; \
  24. wget -O - https://openresty.org/package/pubkey.gpg | apt-key add -; \
  25. case "${arch}" in \
  26. amd64) \
  27. echo "deb https://openresty.org/package/debian $codename openresty" | tee /etc/apt/sources.list.d/openresty.list \
  28. && wget -O - https://repos.apiseven.com/pubkey.gpg | apt-key add - \
  29. && echo "deb https://repos.apiseven.com/packages/debian $codename main" | tee /etc/apt/sources.list.d/apisix.list \
  30. ;; \
  31. arm64) \
  32. echo "deb https://openresty.org/package/arm64/debian $codename openresty" | tee /etc/apt/sources.list.d/openresty.list \
  33. && wget -O - https://repos.apiseven.com/pubkey.gpg | apt-key add - \
  34. && echo "deb https://repos.apiseven.com/packages/arm64/debian $codename main" | tee /etc/apt/sources.list.d/apisix.list \
  35. ;; \
  36. esac; \
  37. apt update \
  38. && apt install -y apisix=${APISIX_VERSION}-0 \
  39. && apt-get purge -y --auto-remove \
  40. && rm -f /etc/apt/sources.list.d/openresty.list /etc/apt/sources.list.d/apisix.list \
  41. && openresty -V \
  42. && apisix version
  43. WORKDIR /usr/local/apisix
  44. ENV PATH=$PATH:/usr/local/openresty/luajit/bin:/usr/local/openresty/nginx/sbin:/usr/local/openresty/bin
  45. RUN groupadd --system --gid 636 apisix \
  46. && useradd --system --gid apisix --no-create-home --shell /usr/sbin/nologin --uid 636 apisix \
  47. && chown -R apisix:apisix /usr/local/apisix
  48. USER apisix
  49. # forward request and error logs to docker log collector
  50. RUN ln -sf /dev/stdout /usr/local/apisix/logs/access.log \
  51. && ln -sf /dev/stderr /usr/local/apisix/logs/error.log
  52. EXPOSE 9080 9443
  53. COPY ./docker-entrypoint.sh /docker-entrypoint.sh
  54. ENTRYPOINT ["/docker-entrypoint.sh"]
  55. CMD ["docker-start"]
  56. STOPSIGNAL SIGQUIT