diff --git a/debian/Dockerfile b/debian/Dockerfile index a90367ec..dd41d6e8 100644 --- a/debian/Dockerfile +++ b/debian/Dockerfile @@ -19,6 +19,8 @@ FROM debian:bookworm-slim ARG APISIX_VERSION=3.16.0 +COPY ./install-brotli.sh /install-brotli.sh + RUN set -ex; \ arch=$(dpkg --print-architecture); \ apt update; \ @@ -33,29 +35,26 @@ RUN set -ex; \ wget -O - https://repos.apiseven.com/pubkey.gpg | apt-key add - \ && echo "deb https://repos.apiseven.com/packages/arm64/debian debian12 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:0 /usr/local/apisix \ + && chmod -R g=u /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:0 /usr/local/apisix \ - && chmod -R g=u /usr/local/apisix - USER apisix # forward request and error logs to docker log collector diff --git a/redhat/Dockerfile b/redhat/Dockerfile index 8469bd82..e4ba7d98 100644 --- a/redhat/Dockerfile +++ b/redhat/Dockerfile @@ -19,33 +19,39 @@ FROM registry.access.redhat.com/ubi9/ubi:9.6 ARG APISIX_VERSION=3.16.0 LABEL apisix_version="${APISIX_VERSION}" + +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 +COPY ./install-brotli.sh /install-brotli.sh -RUN yum update -y \ - && yum install -y apisix-${APISIX_VERSION} wget\ +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 \ + && chmod +x /install-brotli.sh \ + && cd / && ./install-brotli.sh && rm -rf /install-brotli.sh \ + && groupadd --system --gid 636 apisix \ + && useradd --system --gid apisix --no-create-home --shell /usr/sbin/nologin --uid 636 apisix \ + && chown -R apisix:0 /usr/local/apisix \ + && chmod -R g=u /usr/local/apisix \ + # 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 \ - && sed -i 's/PASS_MAX_DAYS\t99999/PASS_MAX_DAYS\t60/g' /etc/login.defs - -COPY ./install-brotli.sh /install-brotli.sh -RUN chmod +x /install-brotli.sh \ - && cd / && ./install-brotli.sh && rm -rf /install-brotli.sh + && rm -rf /var/cache/dnf /var/cache/yum /var/lib/dnf/history.* /tmp/* /var/tmp/* -WORKDIR /usr/local/apisix +USER 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:0 /usr/local/apisix \ - && chmod -R g=u /usr/local/apisix - -# 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 - -USER apisix +WORKDIR /usr/local/apisix EXPOSE 9080 9443 diff --git a/ubuntu/Dockerfile b/ubuntu/Dockerfile index 6b85a632..ed1d9169 100644 --- a/ubuntu/Dockerfile +++ b/ubuntu/Dockerfile @@ -19,6 +19,10 @@ FROM ubuntu:24.04 ARG APISIX_VERSION=3.16.0 +COPY ./install-brotli.sh /install-brotli.sh + +WORKDIR /usr/local/apisix + RUN set -ex; \ arch=$(dpkg --print-architecture); \ apt update; \ @@ -33,29 +37,25 @@ 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 - -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 \ + && 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:0 /usr/local/apisix \ && chmod -R g=u /usr/local/apisix + +ENV PATH=$PATH:/usr/local/openresty/luajit/bin:/usr/local/openresty/nginx/sbin:/usr/local/openresty/bin + USER apisix # forward request and error logs to docker log collector