From 15d1c758635ae7498d9e2035bd0163e33e71acda Mon Sep 17 00:00:00 2001 From: Isa Farnik Date: Tue, 3 Oct 2023 17:06:14 -0700 Subject: [PATCH] feat(*): use cloudsmith URLs --- Dockerfile.rpm | 3 +-- alpine/Dockerfile | 3 ++- rhel/Dockerfile | 4 +++- ubuntu/Dockerfile | 5 +++-- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/Dockerfile.rpm b/Dockerfile.rpm index d8cf53fc..9278f3ee 100644 --- a/Dockerfile.rpm +++ b/Dockerfile.rpm @@ -18,8 +18,7 @@ RUN set -ex; \ arch='x86_64'; \ major_minor="$(echo "${KONG_VERSION%.*}" | tr -d '.')"; \ if [ "$ASSET" = "remote" ] ; then \ - VERSION=$(grep '^VERSION_ID' /etc/os-release | cut -d = -f 2 | sed -e 's/^"//' -e 's/"$//' | cut -d . -f 1) \ - DOWNLOAD_URL="https://packages.konghq.com/public/gateway-${major_minor}/rpm/el/8/${arch}/kong-${KONG_VERSION}-1.${arch}.rpm"; \ + DOWNLOAD_URL="https://packages.konghq.com/public/gateway-${major_minor}/rpm/el/8/${arch}/kong-${KONG_VERSION}.el8.${arch}.rpm"; \ curl -fL $DOWNLOAD_URL -o /tmp/kong.rpm \ && echo "${KONG_SHA256} /tmp/kong.rpm" | sha256sum -c -; \ fi \ diff --git a/alpine/Dockerfile b/alpine/Dockerfile index f331177b..6400cb8b 100644 --- a/alpine/Dockerfile +++ b/alpine/Dockerfile @@ -19,13 +19,14 @@ ARG KONG_ARM64_SHA="f6c90eb9b126e049859f037e81f070f4116ac701c4e4b9ad2d1ec574fbe4 # 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; \ if [ "$ASSET" = "ce" ] ; then \ apk add --no-cache --virtual .build-deps curl wget tar ca-certificates \ - && curl -fL "https://download.konghq.com/gateway-${KONG_VERSION%%.*}.x-alpine/kong-$KONG_VERSION.$arch.apk.tar.gz" -o /tmp/kong.tar.gz \ + && 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 \ diff --git a/rhel/Dockerfile b/rhel/Dockerfile index 331c4def..4421d8a5 100644 --- a/rhel/Dockerfile +++ b/rhel/Dockerfile @@ -30,8 +30,10 @@ 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://download.konghq.com/gateway-${KONG_VERSION%%.*}.x-rhel-$RHEL_VERSION/Packages/k/kong-$KONG_VERSION.rhel${RHEL_VERSION}.amd64.rpm" -o /tmp/kong.rpm \ + 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 \ && echo "$KONG_SHA256 /tmp/kong.rpm" | sha256sum -c -; \ else \ yum update -y \ diff --git a/ubuntu/Dockerfile b/ubuntu/Dockerfile index 41560965..8101ba27 100644 --- a/ubuntu/Dockerfile +++ b/ubuntu/Dockerfile @@ -16,15 +16,16 @@ ARG KONG_ARM64_SHA="1d5c2064d44b76fbb3cabf168dc226e91fedb991ace32915297505d08967 # 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 \ - && 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}_$arch.deb -o /tmp/kong.deb \ + && 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 \