Skip to content

Commit

Permalink
fix(Alpine,rhel): reinstate alpine and rhel Dockerfiles
Browse files Browse the repository at this point in the history
While backporting
d940acc
we inadvertedly stopped supporting Alpine (which is still maintained in
2.8, but not on 3.x) and rhel. This commit reinstates them.

However, the ARM builds are no longer available for Alpine or Rhel (see https://cloudsmith.io/~kong/repos/gateway-28/packages/) so those were removed from the Dockerfiles
  • Loading branch information
kikito committed Jun 26, 2024
1 parent 3fe94ba commit f6ce168
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 15 deletions.
9 changes: 2 additions & 7 deletions Dockerfile.apk
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ ARG KONG_VERSION=2.8.4
ENV KONG_VERSION $KONG_VERSION

ARG KONG_AMD64_SHA="930b3b933b6c3f0393700433a919745900485d19e0cd8aba2d70aa066ccd10d2"
ARG KONG_ARM64_SHA="9027da2a4df477b462f34da9450412012ffdc0f9019e33ed7ff8e88f3df062c6"

ARG KONG_PREFIX=/usr/local/kong
ENV KONG_PREFIX $KONG_PREFIX
Expand All @@ -15,15 +14,11 @@ ARG EE_PORTS
COPY kong.apk.tar.gz /tmp/kong.apk.tar.gz

RUN set -ex; \
arch="$(apk --print-arch)"; \
major_minor="$(echo "${KONG_VERSION%.*}" | tr -d '.')"; \
case "${arch}" in \
x86_64) KONG_SHA256=$KONG_AMD64_SHA ;; \
aarch64) KONG_SHA256=$KONG_ARM64_SHA ;; \
esac; \
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}/raw/names/kong-${arch}/versions/${KONG_VERSION}/kong-${KONG_VERSION}.${arch}.apk.tar.gz" -o /tmp/kong.apk.tar.gz \
curl -fL "https://packages.konghq.com/public/gateway-${major_minor}/alpine/any-version/main/x86_64/kong-${KONG_VERSION}.apk" -o /tmp/kong.apk.tar.gz \
&& echo "$KONG_SHA256 /tmp/kong.apk.tar.gz" | sha256sum -c -; \
fi \
&& apk add --no-cache --virtual .build-deps tar gzip \
Expand Down
8 changes: 2 additions & 6 deletions alpine/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,15 @@ 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)"; \
major_minor="$(echo "${KONG_VERSION%.*}" | tr -d '.')"; \
case "${arch}" in \
x86_64) KONG_SHA256=$KONG_AMD64_SHA ;; \
aarch64) KONG_SHA256=$KONG_ARM64_SHA ;; \
esac; \
KONG_SHA256=$KONG_AMD64_SHA ; \
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 \
&& 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 - \
&& apk del .build-deps; \
else \
Expand Down
3 changes: 1 addition & 2 deletions rhel/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,9 @@ ARG RHEL_VERSION
ENV RHEL_VERSION $RHEL_VERSION

RUN set -ex; \
arch='x86_64'; \
major_minor="$(echo "${KONG_VERSION%.*}" | tr -d '.')"; \
if [ "$ASSET" = "ce" ] ; then \
curl -fL "https://packages.konghq.com/public/gateway-${major_minor}/rpm/el/${RHEL_VERSION}/${arch}/kong-${KONG_VERSION}.el${RHEL_VERSION}.${arch}.rpm" -o /tmp/kong.rpm \
curl -fL "https://packages.konghq.com/public/gateway-${major_minor}/rpm/el/${RHEL_VERSION}/x86_64/kong-${KONG_VERSION}.el${RHEL_VERSION}.x86_64.rpm" -o /tmp/kong.rpm \
&& echo "$KONG_SHA256 /tmp/kong.rpm" | sha256sum -c -; \
else \
yum update -y \
Expand Down
20 changes: 20 additions & 0 deletions update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,26 @@ if [[ -n "$kbt_in_kong_v" ]]; then
sed -i.bak 's/KONG_BUILD_TOOLS?=.*/KONG_BUILD_TOOLS?='$kbt_in_kong_v'/g' Makefile
fi

pushd alpine
url=$(get_url Dockerfile amd64)
echo $url
curl -fL $url -o /tmp/kong
new_sha=$(sha256sum /tmp/kong | cut -b1-64)

sed -i.bak 's/ARG KONG_AMD64_SHA=.*/ARG KONG_AMD64_SHA=\"'$new_sha'\"/g' Dockerfile
sed -i.bak 's/ARG KONG_VERSION=.*/ARG KONG_VERSION='$version'/g' Dockerfile
popd

pushd rhel
url=$(get_url Dockerfile amd64 "RHEL_VERSION=7")
echo $url
curl -fL $url -o /tmp/kong
new_sha=$(sha256sum /tmp/kong | cut -b1-64)

sed -i.bak 's/ARG KONG_SHA256=.*/ARG KONG_SHA256=\"'$new_sha'\"/g' Dockerfile
sed -i.bak 's/ARG KONG_VERSION=.*/ARG KONG_VERSION='$version'/g' Dockerfile
popd

# Dockerfile.rpm
url=$(get_url Dockerfile.rpm x86_64 "VERSION=8")
echo $url
Expand Down

0 comments on commit f6ce168

Please sign in to comment.