From aa4cf106f8933033f433cacc8f073fa4dbbeac21 Mon Sep 17 00:00:00 2001 From: Guilherme Salazar Date: Tue, 14 Jun 2022 13:34:37 -0300 Subject: [PATCH] fix(ubuntu) 2.6.1 includes arm --- Makefile | 2 ++ ubuntu/Dockerfile | 14 ++++++++++---- update.sh | 10 +++++++++- 3 files changed, 21 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index e1827ff8..ac63dd71 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,5 @@ +# DO NOT update KONG_BUILD_TOOLS manually - it's set by update.sh +# to ensure same version is used here and in the respective kong version KONG_BUILD_TOOLS?=4.23.0 BASE?=alpine diff --git a/ubuntu/Dockerfile b/ubuntu/Dockerfile index 8a29f35f..41cabe3c 100644 --- a/ubuntu/Dockerfile +++ b/ubuntu/Dockerfile @@ -10,15 +10,21 @@ COPY kong.deb /tmp/kong.deb ARG KONG_VERSION=2.6.1 ENV KONG_VERSION $KONG_VERSION -ARG KONG_SHA256="f70757f9317a1d40316f0187ae6e91c0c94b5b4346e564f7ae8430775bf7ad7e" +ARG KONG_AMD64_SHA="f70757f9317a1d40316f0187ae6e91c0c94b5b4346e564f7ae8430775bf7ad7e" +ARG KONG_ARM64_SHA="5cba6e7e28685fb7d80b77b70586cfb92c1de4b5198a6218bb1ca0c7f2502c89" # hadolint ignore=DL3015 -RUN set -ex \ - && apt-get update \ +RUN set -ex; \ + arch=$(dpkg --print-architecture); \ + case "${arch}" in \ + amd64) KONG_SHA256=$KONG_AMD64_SHA ;; \ + arm64) KONG_SHA256=$KONG_ARM64_SHA ;; \ + esac; \ + apt-get update \ && if [ "$ASSET" = "ce" ] ; then \ apt-get install -y curl \ && UBUNTU_CODENAME=$(cat /etc/os-release | grep UBUNTU_CODENAME | cut -d = -f 2) \ - && curl -fL https://download.konghq.com/gateway-${KONG_VERSION%%.*}.x-ubuntu-${UBUNTU_CODENAME}/pool/all/k/kong/kong_${KONG_VERSION}_amd64.deb -o /tmp/kong.deb \ + && curl -fL https://download.konghq.com/gateway-${KONG_VERSION%%.*}.x-ubuntu-${UBUNTU_CODENAME}/pool/all/k/kong/kong_${KONG_VERSION}_$arch.deb -o /tmp/kong.deb \ && apt-get purge -y curl \ && echo "$KONG_SHA256 /tmp/kong.deb" | sha256sum -c -; \ else \ diff --git a/update.sh b/update.sh index 1861a8d5..bd34cdbb 100755 --- a/update.sh +++ b/update.sh @@ -83,7 +83,15 @@ pushd ubuntu 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_AMD64_SHA=.*/ARG KONG_AMD64_SHA=\"'$new_sha'\"/g' Dockerfile + + url=$(get_url Dockerfile arm64 "UBUNTU_CODENAME=focal") + echo $url + curl -fL $url -o /tmp/kong + new_sha=$(sha256sum /tmp/kong | cut -b1-64) + + sed -i.bak 's/ARG KONG_ARM64_SHA=.*/ARG KONG_ARM64_SHA=\"'$new_sha'\"/g' Dockerfile + sed -i.bak 's/ARG KONG_VERSION=.*/ARG KONG_VERSION='$version'/g' Dockerfile popd