Skip to content

Commit 5c42943

Browse files
feat(*): use cloudsmith instead of pulp to download packages (#701)
(cherry picked from commit 6c5f899)
1 parent 4dec46e commit 5c42943

File tree

5 files changed

+20
-51
lines changed

5 files changed

+20
-51
lines changed

Dockerfile.deb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ RUN set -ex; \
2020
apt-get install -y curl; \
2121
if [ "$ASSET" = "remote" ] ; then \
2222
CODENAME=$(cat /etc/os-release | grep VERSION_CODENAME | cut -d = -f 2) \
23-
&& DOWNLOAD_URL="https://download.konghq.com/gateway-${KONG_VERSION%%.*}.x-debian-${CODENAME}/pool/all/k/kong/kong_${KONG_VERSION}_amd64.deb" \
23+
&& KONG_REPO=$(echo ${KONG_VERSION%.*} | sed 's/\.//') \
24+
&& DOWNLOAD_URL="https://packages.konghq.com/public/gateway-$KONG_REPO/deb/debian/pool/$CODENAME/main/k/ko/kong_$KONG_VERSION/kong_${KONG_VERSION}_amd64.deb" \
2425
&& curl -fL $DOWNLOAD_URL -o /tmp/kong.deb \
2526
&& echo "$KONG_SHA256 /tmp/kong.deb" | sha256sum -c -; \
2627
fi \

Dockerfile.rpm

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ COPY kong.rpm /tmp/kong.rpm
3131
# hadolint ignore=DL3015
3232
RUN set -ex; \
3333
if [ "$ASSET" = "remote" ] ; then \
34-
DOWNLOAD_URL="https://download.konghq.com/gateway-${KONG_VERSION%%.*}.x-rhel-8/Packages/k/kong-$KONG_VERSION.rhel8.amd64.rpm" \
34+
KONG_REPO=$(echo ${KONG_VERSION%.*} | sed 's/\.//') \
35+
&& DOWNLOAD_URL="https://packages.konghq.com/public/gateway-$KONG_REPO/rpm/el/8/x86_64/kong-$KONG_VERSION.el8.x86_64.rpm" \
3536
&& curl -fL $DOWNLOAD_URL -o /tmp/kong.rpm \
3637
&& echo "$KONG_SHA256 /tmp/kong.rpm" | sha256sum -c - \
3738
|| exit 1; \

build_your_own_images.md

Lines changed: 12 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ To build your Docker image, you will need to provide
2424

2525
## Base image
2626
You can use images derived from RHEL or Ubuntu; Kong Software pushes `.deb`, and
27-
`.rpm` packages to our [public package repository](https://download.konghq.com/).
27+
`.rpm` packages to our [public package repository](https://packages.konghq.com/).
2828

2929
## Entrypoint script
3030

@@ -37,10 +37,10 @@ directory where you are planning to run the command to build your Docker image.
3737

3838
### Decide how to get the Kong Gateway package
3939
Kong Software provides `.deb`, and `.rpm` packages via our [public package
40-
repository](https://download.konghq.com/). Decide whether you want your
40+
repository](https://packages.konghq.com/). Decide whether you want your
4141
Dockerfile to
4242

43-
1. Download the desired package from https://download.konghq.com, or
43+
1. Download the desired package from https://packages.konghq.com, or
4444
2. Download the desired package from another package repository you specify, or
4545
3. Install the desired package locally from disk.
4646

@@ -68,17 +68,11 @@ ENV KONG_VERSION $KONG_VERSION
6868
6969
# Uncomment the ARG KONG_SHA256 line to build a container using a .deb or .rpm package
7070
# For .deb packages, the SHA is in
71-
# https://download.konghq.com/gateway-<gateway-major-version>-<os>-<os_version>/dists/default/all/binary-amd64/Packages
71+
# https://cloudsmith.io/~kong/repos/gateway-<gateway-major-version><gateway-minor-version>/packages/detail/deb/kong/<gateway-version>/a=amd64;xc=main;d=debian%252F<os_version>;t=binary/
7272
# For .rpm packages, the SHA is in
73-
# https://download.konghq.com/gateway-<gateway-major-version>-<os>-<os_version>/repodata/<some-sha>-primary.xml.gz
73+
# https://cloudsmith.io/~kong/repos/gateway-<gateway-major-version><gateway-minor-version>/packages/detail/rpm/kong/<gateway-version>/a=x86_64;d=el%252F<os_version>;t=binary/
7474
# ARG KONG_SHA256="<.deb-or.rpm-SHA>"
7575
76-
# Uncomment to build a container using the .deb.tar.gz Kong Gateway package
77-
# For .deb.tar.gz packages, the SHA is in
78-
# https://download.konghq.com/gateway-<gateway-major-version>-ubuntu/PULP_MANIFEST
79-
# ARG KONG_AMD64_SHA="<amd64_sha>"
80-
# ARG KONG_ARM64_SHA="<arm64_sha>"
81-
8276
# Uncomment to download package from a remote repository
8377
# ARG ASSET=remote
8478
@@ -99,11 +93,12 @@ ARG EE_PORTS
9993
# hadolint ignore=DL3015
10094
# Uncomment the following section if you are installing a .rpm
10195
# Edit the DOWNLOAD_URL line to install from a repository other than
102-
# download.konghq.com
96+
# packages.konghq.com
10397
# RUN set -ex; \
10498
# if [ "$ASSET" = "remote" ] ; then \
10599
# VERSION=$(grep '^VERSION_ID' /etc/os-release | cut -d = -f 2 | sed -e 's/^"//' -e 's/"$//' | cut -d . -f 1) \
106-
# && DOWNLOAD_URL="https://download.konghq.com/gateway-${KONG_VERSION%%.*}.x-rhel-$VERSION/Packages/k/kong-$KONG_VERSION.rhel$VERSION.amd64.rpm" \
100+
# && KONG_REPO=$(echo ${KONG_VERSION%.*} | sed 's/\.//') \
101+
# && DOWNLOAD_URL="https://packages.konghq.com/public/gateway-$KONG_REPO/rpm/el/$VERSION/x86_64/kong-$KONG_VERSION.el$VERSION.x86_64.rpm" \
107102
# && curl -fL $DOWNLOAD_URL -o /tmp/kong.rpm \
108103
# && echo "$KONG_SHA256 /tmp/kong.rpm" | sha256sum -c -; \
109104
# fi \
@@ -119,13 +114,14 @@ ARG EE_PORTS
119114
120115
# Uncomment the following section if you are installing a .deb
121116
# Edit the DOWNLOAD_URL line to install from a repository other than
122-
# download.konghq.com
117+
# packages.konghq.com
123118
# RUN set -ex; \
124119
# apt-get update; \
125120
# apt-get install -y curl; \
126121
# if [ "$ASSET" = "remote" ] ; then \
127122
# CODENAME=$(cat /etc/os-release | grep VERSION_CODENAME | cut -d = -f 2) \
128-
# && DOWNLOAD_URL="https://download.konghq.com/gateway-${KONG_VERSION%%.*}.x-ubuntu-${CODENAME}/pool/all/k/kong/kong_${KONG_VERSION}_amd64.deb" \
123+
# && KONG_REPO=$(echo ${KONG_VERSION%.*} | sed 's/\.//') \
124+
# && DOWNLOAD_URL="https://packages.konghq.com/public/gateway-$KONG_REPO/deb/ubuntu/pool/$CODENAME/main/k/ko/kong_$KONG_VERSION/kong_${KONG_VERSION}_amd64.deb" \
129125
# && curl -fL $DOWNLOAD_URL -o /tmp/kong.deb \
130126
# && echo "$KONG_SHA256 /tmp/kong.deb" | sha256sum -c -; \
131127
# fi \
@@ -140,38 +136,7 @@ ARG EE_PORTS
140136
# && ln -s /usr/local/openresty/luajit/bin/luajit /usr/local/bin/lua \
141137
# && ln -s /usr/local/openresty/nginx/sbin/nginx /usr/local/bin/nginx \
142138
# && kong version \
143-
# && apt-get purge curl -y
144-
145-
# Uncomment the following section if you are installing a .deb.tar.gz
146-
# Edit the DOWNLOAD_URL line to install from a repository other than
147-
# download.konghq.com
148-
# RUN set -ex; \
149-
# deb add bash curl ca-certificates; \
150-
# arch="$(deb --print-arch)"; \
151-
# case "${arch}" in \
152-
# x86_64) export ARCH='amd64'; KONG_SHA256=$KONG_AMD64_SHA ;; \
153-
# aarch64) export ARCH='arm64'; KONG_SHA256=$KONG_ARM64_SHA ;; \
154-
# esac; \
155-
# if [ "$ASSET" = "remote" ] ; then \
156-
# curl -fL "https://download.konghq.com/gateway-${KONG_VERSION%%.*}.x-ubuntu/kong-${KONG_VERSION}.${ARCH}.deb.tar.gz" -o /tmp/kong.deb.tar.gz \
157-
# && echo "$KONG_SHA256 /tmp/kong.deb.tar.gz" | sha256sum -c -; \
158-
# fi \
159-
# && deb add --no-cache --virtual .build-deps tar gzip \
160-
# && tar -C / -xzf /tmp/kong.deb.tar.gz \
161-
# && deb add --no-cache libstdc++ libgcc openssl pcre perl tzdata libcap zlib zlib-dev bash \
162-
# && adduser -S kong \
163-
# && addgroup -S kong \
164-
# && mkdir -p "/usr/local/kong" \
165-
# && chown -R kong:0 /usr/local/kong \
166-
# && chown kong:0 /usr/local/bin/kong \
167-
# && chmod -R g=u /usr/local/kong \
168-
# && rm -rf /tmp/kong.tar.gz \
169-
# && ln -s /usr/local/openresty/bin/resty /usr/local/bin/resty \
170-
# && ln -s /usr/local/openresty/luajit/bin/luajit /usr/local/bin/luajit \
171-
# && ln -s /usr/local/openresty/luajit/bin/luajit /usr/local/bin/lua \
172-
# && ln -s /usr/local/openresty/nginx/sbin/nginx /usr/local/bin/nginx \
173-
# && deb del .build-deps \
174-
# && kong version
139+
# && apt-get purge curl -y
175140
176141
COPY docker-entrypoint.sh /docker-entrypoint.sh
177142

ubuntu/Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ RUN set -ex; \
2626
&& if [ "$ASSET" = "ce" ] ; then \
2727
apt-get install -y --no-install-recommends curl ca-certificates \
2828
&& UBUNTU_CODENAME=$(cat /etc/os-release | grep UBUNTU_CODENAME | cut -d = -f 2) \
29-
&& 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 \
29+
&& KONG_REPO=$(echo ${KONG_VERSION%.*} | sed 's/\.//') \
30+
&& curl -fL https://packages.konghq.com/public/gateway-$KONG_REPO/deb/ubuntu/pool/$UBUNTU_CODENAME/main/k/ko/kong_$KONG_VERSION/kong_${KONG_VERSION}_$arch.deb \
3031
&& apt-get purge -y curl \
3132
&& echo "$KONG_SHA256 /tmp/kong.deb" | sha256sum -c - \
3233
|| exit 1; \

update.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,11 @@ function get_url() {
3434

3535
eval $args
3636

37-
raw_url=$(egrep -o 'https?://download.konghq.com/gateway-[^ ]+' $dockerfile | sed 's/\"//g')
37+
raw_url=$(egrep -o 'https?://packages.konghq.com/public/gateway-[^ ]+' $dockerfile | sed 's/\"//g')
3838

3939
# set variables contained in raw url
4040
KONG_VERSION=$version
41+
KONG_REPO=$(echo ${KONG_VERSION%.*} | sed 's/\.//')
4142
ARCH=$arch
4243

4344
eval echo $raw_url

0 commit comments

Comments
 (0)