diff --git a/debian/Dockerfile b/debian/Dockerfile index b1249033..554db9f5 100644 --- a/debian/Dockerfile +++ b/debian/Dockerfile @@ -19,6 +19,8 @@ FROM debian:bullseye-slim ARG APISIX_VERSION=3.15.0 +COPY ./install-brotli.sh /install-brotli.sh + RUN set -ex; \ arch=$(dpkg --print-architecture); \ apt update; \ @@ -33,28 +35,25 @@ RUN set -ex; \ wget -O - https://repos.apiseven.com/pubkey.gpg | apt-key add - \ && echo "deb https://repos.apiseven.com/packages/arm64/debian $codename main" | tee /etc/apt/sources.list.d/apisix.list \ ;; \ - esac; \ - apt update \ + esac \ + && apt update \ && apt install -y apisix=${APISIX_VERSION}-0 \ - && apt-get purge -y --auto-remove \ && rm /usr/local/openresty/bin/etcdctl \ && openresty -V \ - && apisix version - -COPY ./install-brotli.sh /install-brotli.sh -RUN chmod +x /install-brotli.sh \ - && cd / && ./install-brotli.sh && rm -rf /install-brotli.sh - -RUN apt-get -y purge --auto-remove curl wget gnupg --allow-remove-essential + && apisix version \ + && bash /install-brotli.sh \ + && rm -f /install-brotli.sh \ + && apt-get -y purge --auto-remove curl wget gnupg --allow-remove-essential \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* \ + && groupadd --system --gid 636 apisix \ + && useradd --system --gid apisix --no-create-home --shell /usr/sbin/nologin --uid 636 apisix \ + && chown -R apisix:apisix /usr/local/apisix WORKDIR /usr/local/apisix ENV PATH=$PATH:/usr/local/openresty/luajit/bin:/usr/local/openresty/nginx/sbin:/usr/local/openresty/bin -RUN groupadd --system --gid 636 apisix \ - && useradd --system --gid apisix --no-create-home --shell /usr/sbin/nologin --uid 636 apisix \ - && chown -R apisix:apisix /usr/local/apisix - USER apisix # forward request and error logs to docker log collector diff --git a/redhat/Dockerfile b/redhat/Dockerfile index ab3213ba..4a6edd6b 100644 --- a/redhat/Dockerfile +++ b/redhat/Dockerfile @@ -19,27 +19,31 @@ FROM registry.access.redhat.com/ubi9/ubi:9.6 ARG APISIX_VERSION=3.15.0 LABEL apisix_version="${APISIX_VERSION}" -COPY ./yum.repos.d/apache-apisix.repo /etc/yum.repos.d/apache-apisix.repo -COPY ./yum.repos.d/openresty.repo /etc/yum.repos.d/openresty.repo -RUN yum update -y \ - && yum install -y apisix-${APISIX_VERSION} wget\ - && yum clean all \ - && sed -i 's/PASS_MAX_DAYS\t99999/PASS_MAX_DAYS\t60/g' /etc/login.defs +WORKDIR /usr/local/apisix +COPY ./yum.repos.d/apache-apisix.repo /etc/yum.repos.d/apache-apisix.repo +COPY ./yum.repos.d/openresty.repo /etc/yum.repos.d/openresty.repo COPY ./install-brotli.sh /install-brotli.sh -RUN chmod +x /install-brotli.sh \ - && cd / && ./install-brotli.sh && rm -rf /install-brotli.sh -WORKDIR /usr/local/apisix +RUN set -ex; \ + yum makecache -y \ + && yum install -y \ + --setopt=install_weak_deps=False \ + --setopt=tsflags=nodocs \ + apisix-${APISIX_VERSION} wget\ + && sed -i 's/PASS_MAX_DAYS\t99999/PASS_MAX_DAYS\t60/g' /etc/login.defs \ + && cd / && bash /install-brotli.sh \ + && rm -rf /install-brotli.sh \ +# forward request and error logs to docker log collector + && ln -sf /dev/stdout /usr/local/apisix/logs/access.log \ + && ln -sf /dev/stderr /usr/local/apisix/logs/error.log \ + && rm /usr/local/openresty/bin/etcdctl \ + && yum clean all \ + && rm -rf /var/cache/dnf /var/cache/yum /var/lib/dnf/history.* /tmp/* /var/tmp/* ENV PATH=$PATH:/usr/local/openresty/luajit/bin:/usr/local/openresty/nginx/sbin:/usr/local/openresty/bin -# forward request and error logs to docker log collector -RUN ln -sf /dev/stdout /usr/local/apisix/logs/access.log \ - && ln -sf /dev/stderr /usr/local/apisix/logs/error.log \ - && rm /usr/local/openresty/bin/etcdctl - EXPOSE 9080 9443 COPY ./docker-entrypoint.sh /docker-entrypoint.sh diff --git a/ubuntu/Dockerfile b/ubuntu/Dockerfile index 2cc911db..40c7c833 100644 --- a/ubuntu/Dockerfile +++ b/ubuntu/Dockerfile @@ -19,6 +19,10 @@ FROM ubuntu:24.04 ARG APISIX_VERSION=3.15.0 +COPY ./install-brotli.sh /install-brotli.sh + +WORKDIR /usr/local/apisix + RUN set -ex; \ arch=$(dpkg --print-architecture); \ apt update; \ @@ -33,28 +37,24 @@ RUN set -ex; \ wget -O - https://repos.apiseven.com/pubkey.gpg | apt-key add - \ && echo "deb https://repos.apiseven.com/packages/arm64/ubuntu $VERSION_CODENAME main" | tee /etc/apt/sources.list.d/apisix.list \ ;; \ - esac; \ - apt update \ + esac \ + && apt update \ && apt install -y apisix=${APISIX_VERSION}-0 \ - && apt-get purge -y --auto-remove \ && rm /usr/local/openresty/bin/etcdctl \ && openresty -V \ - && apisix version - -COPY ./install-brotli.sh /install-brotli.sh -RUN chmod +x /install-brotli.sh \ - && cd / && ./install-brotli.sh && rm -rf /install-brotli.sh - -RUN apt-get -y purge --auto-remove curl wget gnupg --allow-remove-essential + && apisix version \ + && bash /install-brotli.sh \ + && rm -f /install-brotli.sh \ + && apt-get -y purge --auto-remove curl wget gnupg --allow-remove-essential \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* \ + && groupadd --system --gid 636 apisix \ + && useradd --system --gid apisix --no-create-home --shell /usr/sbin/nologin --uid 636 apisix \ + && chown -R apisix:apisix /usr/local/apisix -WORKDIR /usr/local/apisix ENV PATH=$PATH:/usr/local/openresty/luajit/bin:/usr/local/openresty/nginx/sbin:/usr/local/openresty/bin -RUN groupadd --system --gid 636 apisix \ - && useradd --system --gid apisix --no-create-home --shell /usr/sbin/nologin --uid 636 apisix \ - && chown -R apisix:apisix /usr/local/apisix - USER apisix # forward request and error logs to docker log collector