Dockerfile 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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.3.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 useradd -u 1001 apisix && chown -R apisix:apisix /usr/local/apisix
  46. USER apisix
  47. # forward request and error logs to docker log collector
  48. RUN ln -sf /dev/stdout /usr/local/apisix/logs/access.log \
  49. && ln -sf /dev/stderr /usr/local/apisix/logs/error.log
  50. EXPOSE 9080 9443
  51. COPY ./docker-entrypoint.sh /docker-entrypoint.sh
  52. ENTRYPOINT ["/docker-entrypoint.sh"]
  53. CMD ["docker-start"]
  54. STOPSIGNAL SIGQUIT