Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reinstate Kong Alpine 2.8.5 as the main version #17067

Merged
merged 1 commit into from
Jul 3, 2024

Conversation

kikito
Copy link
Contributor

@kikito kikito commented Jun 27, 2024

There was some confusion during the release of kong 2.8.5. While on the 3.x series we no longer maintain Alpine, it is still maintained in 2.x

As such, this PR reinstates Alpine as the head for 2.8.x.

The change in the Ubuntu SHA is due to the fact that we had to add a new commit to the branch in order to rebuild alpine. The ubuntu files are otherwise unchanged

@kikito kikito requested a review from a team as a code owner June 27, 2024 15:54

This comment has been minimized.

library/kong Outdated Show resolved Hide resolved

This comment has been minimized.

LaurentGoderre
LaurentGoderre previously approved these changes Jun 27, 2024
@tianon
Copy link
Member

tianon commented Jun 27, 2024

I did some local munging of diff-pr.sh to try and get a better diff across the pre-#17048 state so we can see the changes better without it looking like a whole new version:

Diff:
diff --git a/_bashbrew-cat b/_bashbrew-cat
index 2b56589..83f570c 100644
--- a/_bashbrew-cat
+++ b/_bashbrew-cat
@@ -1,14 +1,14 @@
 Maintainers: Kong Docker Maintainers <[email protected]> (@team-gateway-bot)
 GitRepo: https://github.com/Kong/docker-kong.git
 
-Tags: 2.8.4-alpine, 2.8.4, 2.8
-GitFetch: refs/tags/2.8.4
-GitCommit: 1c31704cdc9bbd2c0a20e5479eb307140339582b
+Tags: 2.8.5-alpine, 2.8-alpine, 2.8.5, 2.8, 2
+GitFetch: refs/tags/2.8.5
+GitCommit: 246616ef3ccd0016c9911cc55dd5891f050ba065
 Directory: alpine
 
-Tags: 2.8.4-ubuntu, 2.8-ubuntu
-GitFetch: refs/tags/2.8.4
-GitCommit: 1c31704cdc9bbd2c0a20e5479eb307140339582b
+Tags: 2.8.5-ubuntu, 2.8-ubuntu
+GitFetch: refs/tags/2.8.5
+GitCommit: 246616ef3ccd0016c9911cc55dd5891f050ba065
 Directory: ubuntu
 
 Tags: 3.4.2-ubuntu, 3.4-ubuntu, 3.4.2, 3.4
diff --git a/_bashbrew-list b/_bashbrew-list
index 1b9332d..263ed45 100644
--- a/_bashbrew-list
+++ b/_bashbrew-list
@@ -1,8 +1,10 @@
+kong:2
 kong:2.8
+kong:2.8-alpine
 kong:2.8-ubuntu
-kong:2.8.4
-kong:2.8.4-alpine
-kong:2.8.4-ubuntu
+kong:2.8.5
+kong:2.8.5-alpine
+kong:2.8.5-ubuntu
 kong:3
 kong:3.4
 kong:3.4-ubuntu
diff --git a/kong_2.8-ubuntu/Dockerfile b/kong_2.8-ubuntu/Dockerfile
index 6d3d2de..f9c9723 100644
--- a/kong_2.8-ubuntu/Dockerfile
+++ b/kong_2.8-ubuntu/Dockerfile
@@ -7,10 +7,10 @@ ARG EE_PORTS
 
 COPY kong.deb /tmp/kong.deb
 
-ARG KONG_VERSION=2.8.4
+ARG KONG_VERSION=2.8.5
 ENV KONG_VERSION $KONG_VERSION
 
-ARG KONG_AMD64_SHA="e4bc62c80f717114cc486776ee453931c5de0e8eaf0901ac11dbb4b2bae14534"
+ARG KONG_AMD64_SHA="efba2bb8b1cb567bc90cc371e80503c558cbc74377b34609552ae2273def3fe3"
 ARG KONG_ARM64_SHA="4fff44f9a0c7b06469591b7d1499a99a100109bc3f08dc412dd0eb38ff383d35"
 
 # hadolint ignore=DL3015
@@ -36,15 +36,15 @@ RUN set -ex; \
     # Please update the ubuntu install docs if the below line is changed so that
     # end users can properly install Kong along with its required dependencies
     # and that our CI does not diverge from our docs.
-    && apt install --yes /tmp/kong.deb \
+    && apt install --yes /tmp/kong.deb luarocks\
     && rm -rf /var/lib/apt/lists/* \
     && rm -rf /tmp/kong.deb \
     && chown kong:0 /usr/local/bin/kong \
     && chown -R kong:0 /usr/local/kong \
-    && ln -s /usr/local/openresty/bin/resty /usr/local/bin/resty \
-    && ln -s /usr/local/openresty/luajit/bin/luajit /usr/local/bin/luajit \
-    && ln -s /usr/local/openresty/luajit/bin/luajit /usr/local/bin/lua \
-    && ln -s /usr/local/openresty/nginx/sbin/nginx /usr/local/bin/nginx \
+    && ln -sf /usr/local/openresty/bin/resty /usr/local/bin/resty \
+    && ln -sf /usr/local/openresty/luajit/bin/luajit /usr/local/bin/luajit \
+    && ln -sf /usr/local/openresty/luajit/bin/luajit /usr/local/bin/lua \
+    && ln -sf /usr/local/openresty/nginx/sbin/nginx /usr/local/bin/nginx \
     && if [ "$ASSET" = "ce" ] ; then \
       kong version ; \
     fi
diff --git a/kong_2.8/Dockerfile b/kong_2/Dockerfile
similarity index 25%
rename from kong_2.8/Dockerfile
rename to kong_2/Dockerfile
index 0a4e724..f3a089a 100644
--- a/kong_2.8/Dockerfile
+++ b/kong_2/Dockerfile
@@ -1,58 +1,43 @@
 FROM alpine:3.18
 
-LABEL maintainer="Kong <[email protected]>"
+ARG KONG_VERSION=2.8.5
+ENV KONG_VERSION $KONG_VERSION
+
+ARG KONG_AMD64_SHA="22a5cd7c981ec15b34db105aabac7815bd589380a8d27d0c9e138657a9da6332"
 
-ARG ASSET=ce
-ENV ASSET $ASSET
+ARG KONG_PREFIX=/usr/local/kong
+ENV KONG_PREFIX $KONG_PREFIX
 
+ARG ASSET=remote
 ARG EE_PORTS
 
-# hadolint ignore=DL3010
 COPY kong.tar.gz /tmp/kong.tar.gz
 
-ARG KONG_VERSION=2.8.4
-ENV KONG_VERSION $KONG_VERSION
-
-ARG KONG_AMD64_SHA="930b3b933b6c3f0393700433a919745900485d19e0cd8aba2d70aa066ccd10d2"
-ARG KONG_ARM64_SHA="9027da2a4df477b462f34da9450412012ffdc0f9019e33ed7ff8e88f3df062c6"
-
-# hadolint ignore=DL3018
-RUN set -eux; \
-    arch="$(apk --print-arch)"; \
+RUN set -ex; \
     major_minor="$(echo "${KONG_VERSION%.*}" | tr -d '.')"; \
-    case "${arch}" in \
-      x86_64) KONG_SHA256=$KONG_AMD64_SHA ;; \
-      aarch64) KONG_SHA256=$KONG_ARM64_SHA ;; \
-    esac; \
-    if [ "$ASSET" = "ce" ] ; then \
-      apk add --no-cache --virtual .build-deps curl wget tar ca-certificates \
-      && curl -fL "https://packages.konghq.com/public/gateway-${major_minor}/raw/names/kong-${arch}/versions/${KONG_VERSION}/kong-${KONG_VERSION}.${arch}.apk.tar.gz" -o /tmp/kong.tar.gz \
-      && echo "$KONG_SHA256  /tmp/kong.tar.gz" | sha256sum -c - \
-      && apk del .build-deps; \
-    else \
-      # this needs to stay inside this "else" block so that it does not become part of the "official images" builds (https://github.com/docker-library/official-images/pull/11532#issuecomment-996219700)
-      apk upgrade; \
+    KONG_SHA256=$KONG_AMD64_SHA ; \
+    apk add bash curl ca-certificates; \
+    if [ "$ASSET" = "remote" ] ; then \
+      curl -fL "https://packages.konghq.com/public/gateway-${major_minor}/alpine/any-version/main/x86_64/kong-${KONG_VERSION}.apk" -o /tmp/kong.tar.gz \
+      && echo "$KONG_SHA256  /tmp/kong.tar.gz" | sha256sum -c -; \
     fi \
-    && mkdir /kong \
-    && tar -C /kong -xzf /tmp/kong.tar.gz \
-    && mv /kong/usr/local/* /usr/local \
-    && mv /kong/etc/* /etc \
-    && rm -rf /kong \
-    && apk add --no-cache libstdc++ libgcc openssl pcre perl tzdata libcap zip bash zlib zlib-dev git ca-certificates \
+    && apk add --no-cache --virtual .build-deps tar gzip \
+    && tar -C / -xzf /tmp/kong.tar.gz \
+    && apk add --no-cache libstdc++ libgcc openssl pcre perl tzdata libcap zlib zlib-dev bash luarocks yaml \
     && adduser -S kong \
     && addgroup -S kong \
-    && mkdir -p "/usr/local/kong" \
-    && chown -R kong:0 /usr/local/kong \
+    && mkdir -p "${KONG_PREFIX}" \
+    && chown -R kong:0 ${KONG_PREFIX} \
     && chown kong:0 /usr/local/bin/kong \
-    && chmod -R g=u /usr/local/kong \
+    && chmod -R g=u ${KONG_PREFIX} \
     && rm -rf /tmp/kong.tar.gz \
-    && ln -s /usr/local/openresty/bin/resty /usr/local/bin/resty \
-    && ln -s /usr/local/openresty/luajit/bin/luajit /usr/local/bin/luajit \
-    && ln -s /usr/local/openresty/luajit/bin/luajit /usr/local/bin/lua \
-    && ln -s /usr/local/openresty/nginx/sbin/nginx /usr/local/bin/nginx \
-    && if [ "$ASSET" = "ce" ] ; then \
-      kong version; \
-    fi
+    && ln -sf /usr/local/openresty/bin/resty /usr/local/bin/resty \
+    && ln -sf /usr/local/openresty/luajit/bin/luajit /usr/local/bin/luajit \
+    && ln -sf /usr/local/openresty/luajit/bin/luajit /usr/local/bin/lua \
+    && ln -sf /usr/local/openresty/nginx/sbin/nginx /usr/local/bin/nginx \
+    && ln -sf /usr/local/lib/luarocks/*/luarocks/*/bin/luarocks-admin /usr/local/bin/luarocks-admin \
+    && apk del .build-deps \
+    && kong version
 
 COPY docker-entrypoint.sh /docker-entrypoint.sh
 
diff --git a/kong_2.8/docker-entrypoint.sh b/kong_2/docker-entrypoint.sh
similarity index 100%
rename from kong_2.8/docker-entrypoint.sh
rename to kong_2/docker-entrypoint.sh
diff --git a/kong_2.8/kong.tar.gz b/kong_2/kong.tar.gz
similarity index 100%
rename from kong_2.8/kong.tar.gz
rename to kong_2/kong.tar.gz

Doing this still brings a surprisingly large delta -- is that intentional?

@kikito
Copy link
Contributor Author

kikito commented Jun 28, 2024

Hello @tianon, thank you for checking. I have reviewed the diff and I think it is correct.

  • The changes in library/ubuntu are the expected ones
  • The changes in the Ubuntu dockerfile (the one with kong.deb) only amount to adding luarocks as a dependency, which doesn't have an impact on the release
  • The changes in the Alpine dockerfile (the one with the apk) are extensive because this time we wanted to make sure that our internal tests passed before releasing a new version. 2.8.4 was released as an emergency patch in order to fix a CVE. The changes amount to:
    • Removing the ARM Alpine build, which we no longer produce. I think this is the change that makes git not able to produce a smaller diff.
    • Adding a link to luarocks-admin
    • Other smaller changes like removing the manual installation of curl

The diff coincides with the diff generated from the new head of 2.8.x and the previous one:
https://github.com/Kong/docker-kong/compare/c50856decf89512005c95c8b991ef6a24adef0e8..release/2.8.x

@yosifkit
Copy link
Member

apk add bash curl ca-certificates should have a --no-cache.

Also, these packages are no longer removed like the previous Dockerfile since they are not grouped into the removed virtual package. Perhaps the apk add --no-cache --virtual .build-deps tar gzip could be combined up with this install, so that they are all part of the virtual package that gets removed? Oh, bash and ca-certificates were also installed again in the old Dockerfile, so the only difference is that curl now sticks around.

This comment has been minimized.

@kikito
Copy link
Contributor Author

kikito commented Jul 1, 2024

@tianon I added --no-cache as requested, thank you!

library/kong Outdated Show resolved Hide resolved
GitCommit: cdf93ae2106f998a2245a3eee6814b1ae68781af
GitFetch: refs/tags/2.8.5
Directory: ubuntu
Architectures: amd64
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason why we don't have arm64?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We literally don't build it any more. The low usage made us invest the resources into something else when we changed our build.

There was some confusion during the release of kong 2.8.5.
While on the 3.x series we no longer maintain Alpine, it is still
maintained in 2.x

As such, this PR reinstates Alpine as the head for 2.8.x.

The change in the Ubuntu SHA is due to the fact that we had to add a new
commit to the branch in order to rebuild alpine. The ubuntu files are
otherwise unchanged
@kikito kikito force-pushed the kong-2.8.5-alpine branch from b2d5752 to 904f618 Compare July 2, 2024 13:18
Copy link

github-actions bot commented Jul 2, 2024

Diff for 904f618:
diff --git a/_bashbrew-cat b/_bashbrew-cat
index 253f3dd..581cba4 100644
--- a/_bashbrew-cat
+++ b/_bashbrew-cat
@@ -1,9 +1,14 @@
 Maintainers: Kong Docker Maintainers <[email protected]> (@team-gateway-bot)
 GitRepo: https://github.com/Kong/docker-kong.git
 
-Tags: 2.8.5-ubuntu, 2.8-ubuntu, 2.8.5, 2.8, 2
+Tags: 2.8.5-alpine, 2.8-alpine, 2.8.5, 2.8, 2
 GitFetch: refs/tags/2.8.5
-GitCommit: 3fe94ba928bf75b385bd98aa2d5ad07b86fd3eb8
+GitCommit: cdf93ae2106f998a2245a3eee6814b1ae68781af
+Directory: alpine
+
+Tags: 2.8.5-ubuntu, 2.8-ubuntu
+GitFetch: refs/tags/2.8.5
+GitCommit: cdf93ae2106f998a2245a3eee6814b1ae68781af
 Directory: ubuntu
 
 Tags: 3.4.2-ubuntu, 3.4-ubuntu, 3.4.2, 3.4
diff --git a/_bashbrew-list b/_bashbrew-list
index c67a87a..263ed45 100644
--- a/_bashbrew-list
+++ b/_bashbrew-list
@@ -1,7 +1,9 @@
 kong:2
 kong:2.8
+kong:2.8-alpine
 kong:2.8-ubuntu
 kong:2.8.5
+kong:2.8.5-alpine
 kong:2.8.5-ubuntu
 kong:3
 kong:3.4
diff --git a/_bashbrew-list-build-order b/_bashbrew-list-build-order
index 05e66d4..dafab4e 100644
--- a/_bashbrew-list-build-order
+++ b/_bashbrew-list-build-order
@@ -1,4 +1,5 @@
 kong:2
+kong:2.8-ubuntu
 kong:3.4
 kong:3.5
 kong:3.6
diff --git a/kong_2/Dockerfile b/kong_2.8-ubuntu/Dockerfile
similarity index 100%
copy from kong_2/Dockerfile
copy to kong_2.8-ubuntu/Dockerfile
diff --git a/kong_2/docker-entrypoint.sh b/kong_2.8-ubuntu/docker-entrypoint.sh
similarity index 100%
copy from kong_2/docker-entrypoint.sh
copy to kong_2.8-ubuntu/docker-entrypoint.sh
diff --git a/kong_2/kong.deb b/kong_2.8-ubuntu/kong.deb
similarity index 100%
rename from kong_2/kong.deb
rename to kong_2.8-ubuntu/kong.deb
diff --git a/kong_2/Dockerfile b/kong_2/Dockerfile
index f9c9723..e13cd3f 100644
--- a/kong_2/Dockerfile
+++ b/kong_2/Dockerfile
@@ -1,53 +1,43 @@
-FROM ubuntu:jammy
+FROM alpine:3.18
 
-ARG ASSET=ce
-ENV ASSET $ASSET
+ARG KONG_VERSION=2.8.5
+ENV KONG_VERSION $KONG_VERSION
 
-ARG EE_PORTS
+ARG KONG_AMD64_SHA="22a5cd7c981ec15b34db105aabac7815bd589380a8d27d0c9e138657a9da6332"
 
-COPY kong.deb /tmp/kong.deb
+ARG KONG_PREFIX=/usr/local/kong
+ENV KONG_PREFIX $KONG_PREFIX
 
-ARG KONG_VERSION=2.8.5
-ENV KONG_VERSION $KONG_VERSION
+ARG ASSET=remote
+ARG EE_PORTS
 
-ARG KONG_AMD64_SHA="efba2bb8b1cb567bc90cc371e80503c558cbc74377b34609552ae2273def3fe3"
-ARG KONG_ARM64_SHA="4fff44f9a0c7b06469591b7d1499a99a100109bc3f08dc412dd0eb38ff383d35"
+COPY kong.tar.gz /tmp/kong.tar.gz
 
-# hadolint ignore=DL3015
 RUN set -ex; \
-    arch=$(dpkg --print-architecture); \
     major_minor="$(echo "${KONG_VERSION%.*}" | tr -d '.')"; \
-    case "${arch}" in \
-      amd64) KONG_SHA256=$KONG_AMD64_SHA ;; \
-      arm64) KONG_SHA256=$KONG_ARM64_SHA ;; \
-    esac; \
-    apt-get update \
-    && if [ "$ASSET" = "ce" ] ; then \
-      CODENAME=$(grep -m1 VERSION_CODENAME /etc/os-release | cut -d = -f 2); \
-      apt-get install -y curl \
-      && curl -fL "https://packages.konghq.com/public/gateway-${major_minor}/deb/ubuntu/pool/${CODENAME}/main/k/ko/kong_${KONG_VERSION}/kong_${KONG_VERSION}_${arch}.deb" -o /tmp/kong.deb \
-      && apt-get purge -y curl \
-      && echo "$KONG_SHA256  /tmp/kong.deb" | sha256sum -c -; \
-    else \
-      # this needs to stay inside this "else" block so that it does not become part of the "official images" builds (https://github.com/docker-library/official-images/pull/11532#issuecomment-996219700)
-      apt-get upgrade -y ; \
+    KONG_SHA256=$KONG_AMD64_SHA ; \
+    apk add --no-cache curl bash ca-certificates; \
+    if [ "$ASSET" = "remote" ] ; then \
+      curl -fL "https://packages.konghq.com/public/gateway-${major_minor}/alpine/any-version/main/x86_64/kong-${KONG_VERSION}.apk" -o /tmp/kong.tar.gz \
+      && echo "$KONG_SHA256  /tmp/kong.tar.gz" | sha256sum -c -; \
     fi \
-    && apt-get install -y --no-install-recommends unzip git \
-    # Please update the ubuntu install docs if the below line is changed so that
-    # end users can properly install Kong along with its required dependencies
-    # and that our CI does not diverge from our docs.
-    && apt install --yes /tmp/kong.deb luarocks\
-    && rm -rf /var/lib/apt/lists/* \
-    && rm -rf /tmp/kong.deb \
+    && apk add --no-cache --virtual .build-deps tar gzip \
+    && tar -C / -xzf /tmp/kong.tar.gz \
+    && apk add --no-cache libstdc++ libgcc openssl pcre perl tzdata libcap zlib zlib-dev bash luarocks yaml \
+    && adduser -S kong \
+    && addgroup -S kong \
+    && mkdir -p "${KONG_PREFIX}" \
+    && chown -R kong:0 ${KONG_PREFIX} \
     && chown kong:0 /usr/local/bin/kong \
-    && chown -R kong:0 /usr/local/kong \
+    && chmod -R g=u ${KONG_PREFIX} \
+    && rm -rf /tmp/kong.tar.gz \
     && ln -sf /usr/local/openresty/bin/resty /usr/local/bin/resty \
     && ln -sf /usr/local/openresty/luajit/bin/luajit /usr/local/bin/luajit \
     && ln -sf /usr/local/openresty/luajit/bin/luajit /usr/local/bin/lua \
     && ln -sf /usr/local/openresty/nginx/sbin/nginx /usr/local/bin/nginx \
-    && if [ "$ASSET" = "ce" ] ; then \
-      kong version ; \
-    fi
+    && ln -sf /usr/local/lib/luarocks/*/luarocks/*/bin/luarocks-admin /usr/local/bin/luarocks-admin \
+    && apk del .build-deps \
+    && kong version
 
 COPY docker-entrypoint.sh /docker-entrypoint.sh
 
diff --git a/_bashbrew.err b/kong_2/kong.tar.gz
similarity index 100%
copy from _bashbrew.err
copy to kong_2/kong.tar.gz

Relevant Maintainers:

@yosifkit yosifkit requested a review from tianon July 2, 2024 23:52
@tianon tianon merged commit 4af6e43 into docker-library:master Jul 3, 2024
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants