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

feat(*): use cloudsmith instead of pulp to download packages #701

Merged
merged 1 commit into from
May 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions Dockerfile.deb
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
FROM debian:bullseye-20230502-slim

LABEL maintainer="Kong Docker Maintainers <[email protected]> (@team-gateway-bot)"
ARG KONG_VERSION=3.6.1
ARG KONG_VERSION=3.7.0
ENV KONG_VERSION $KONG_VERSION

ARG KONG_SHA256="97da5168777d5ebc48ff5488d254bee930c52a631203e94c76b3b9dcc83a5d5c"
ARG KONG_SHA256="3f325e456d884f809b9480100dfb2ae613467fec6864a86e08c44b52a010d73a"

ARG KONG_PREFIX=/usr/local/kong
ENV KONG_PREFIX $KONG_PREFIX
Expand All @@ -20,7 +20,8 @@ RUN set -ex; \
apt-get install -y curl; \
if [ "$ASSET" = "remote" ] ; then \
CODENAME=$(cat /etc/os-release | grep VERSION_CODENAME | cut -d = -f 2) \
&& DOWNLOAD_URL="https://download.konghq.com/gateway-${KONG_VERSION%%.*}.x-debian-${CODENAME}/pool/all/k/kong/kong_${KONG_VERSION}_amd64.deb" \
&& KONG_REPO=$(echo ${KONG_VERSION%.*} | sed 's/\.//') \
&& 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" \
&& curl -fL $DOWNLOAD_URL -o /tmp/kong.deb \
&& echo "$KONG_SHA256 /tmp/kong.deb" | sha256sum -c -; \
fi \
Expand Down
7 changes: 4 additions & 3 deletions Dockerfile.rpm
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ FROM registry.access.redhat.com/ubi8/ubi-minimal:8.7@sha256:6910799b75ad41f00891

LABEL maintainer="Kong Docker Maintainers <[email protected]> (@team-gateway-bot)"

ARG KONG_VERSION=3.6.1
ARG KONG_VERSION=3.7.0
ENV KONG_VERSION $KONG_VERSION

# RedHat required labels
Expand All @@ -18,7 +18,7 @@ LABEL name="Kong" \
# RedHat required LICENSE file approved path
COPY LICENSE /licenses/

ARG KONG_SHA256="18b9cdcf7d89b4cbaa8d30c1115fea7e8f8ecfb8d4fd7126e3c3ff8c3d9b405c"
ARG KONG_SHA256="f9f00e9674c970aa366cd2f4d6e597edb867084a84caee299c444cc973b5d8eb"

ARG KONG_PREFIX=/usr/local/kong
ENV KONG_PREFIX $KONG_PREFIX
Expand All @@ -31,7 +31,8 @@ COPY kong.rpm /tmp/kong.rpm
# hadolint ignore=DL3015
RUN set -ex; \
if [ "$ASSET" = "remote" ] ; then \
DOWNLOAD_URL="https://download.konghq.com/gateway-${KONG_VERSION%%.*}.x-rhel-8/Packages/k/kong-$KONG_VERSION.rhel8.amd64.rpm" \
KONG_REPO=$(echo ${KONG_VERSION%.*} | sed 's/\.//') \
&& DOWNLOAD_URL="https://packages.konghq.com/public/gateway-$KONG_REPO/rpm/el/8/x86_64/kong-$KONG_VERSION.el8.x86_64.rpm" \
&& curl -fL $DOWNLOAD_URL -o /tmp/kong.rpm \
&& echo "$KONG_SHA256 /tmp/kong.rpm" | sha256sum -c - \
|| exit 1; \
Expand Down
59 changes: 12 additions & 47 deletions build_your_own_images.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ To build your Docker image, you will need to provide

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

## Entrypoint script

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

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

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

Expand Down Expand Up @@ -68,17 +68,11 @@ ENV KONG_VERSION $KONG_VERSION

# Uncomment the ARG KONG_SHA256 line to build a container using a .deb or .rpm package
# For .deb packages, the SHA is in
# https://download.konghq.com/gateway-<gateway-major-version>-<os>-<os_version>/dists/default/all/binary-amd64/Packages
# 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/
# For .rpm packages, the SHA is in
# https://download.konghq.com/gateway-<gateway-major-version>-<os>-<os_version>/repodata/<some-sha>-primary.xml.gz
# 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/
# ARG KONG_SHA256="<.deb-or.rpm-SHA>"

# Uncomment to build a container using the .deb.tar.gz Kong Gateway package
# For .deb.tar.gz packages, the SHA is in
# https://download.konghq.com/gateway-<gateway-major-version>-ubuntu/PULP_MANIFEST
# ARG KONG_AMD64_SHA="<amd64_sha>"
# ARG KONG_ARM64_SHA="<arm64_sha>"
Comment on lines -76 to -80
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I removed the mentions to this .deb.tar.gz packages as I could not find them. If the reference is still relevant, please let me know and I will add it back.

Copy link
Member

Choose a reason for hiding this comment

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

Agreed with this, leaving the comment up and "unresolved" for future reviewers.


# Uncomment to download package from a remote repository
# ARG ASSET=remote

Expand All @@ -99,11 +93,12 @@ ARG EE_PORTS
# hadolint ignore=DL3015
# Uncomment the following section if you are installing a .rpm
# Edit the DOWNLOAD_URL line to install from a repository other than
# download.konghq.com
# packages.konghq.com
# RUN set -ex; \
# 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://download.konghq.com/gateway-${KONG_VERSION%%.*}.x-rhel-$VERSION/Packages/k/kong-$KONG_VERSION.rhel$VERSION.amd64.rpm" \
# && KONG_REPO=$(echo ${KONG_VERSION%.*} | sed 's/\.//') \
# && DOWNLOAD_URL="https://packages.konghq.com/public/gateway-$KONG_REPO/rpm/el/$VERSION/x86_64/kong-$KONG_VERSION.el$VERSION.x86_64.rpm" \
# && curl -fL $DOWNLOAD_URL -o /tmp/kong.rpm \
# && echo "$KONG_SHA256 /tmp/kong.rpm" | sha256sum -c -; \
# fi \
Expand All @@ -119,13 +114,14 @@ ARG EE_PORTS

# Uncomment the following section if you are installing a .deb
# Edit the DOWNLOAD_URL line to install from a repository other than
# download.konghq.com
# packages.konghq.com
# RUN set -ex; \
# apt-get update; \
# apt-get install -y curl; \
# if [ "$ASSET" = "remote" ] ; then \
# CODENAME=$(cat /etc/os-release | grep VERSION_CODENAME | cut -d = -f 2) \
# && DOWNLOAD_URL="https://download.konghq.com/gateway-${KONG_VERSION%%.*}.x-ubuntu-${CODENAME}/pool/all/k/kong/kong_${KONG_VERSION}_amd64.deb" \
# && KONG_REPO=$(echo ${KONG_VERSION%.*} | sed 's/\.//') \
# && 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" \
# && curl -fL $DOWNLOAD_URL -o /tmp/kong.deb \
# && echo "$KONG_SHA256 /tmp/kong.deb" | sha256sum -c -; \
# fi \
Expand All @@ -140,38 +136,7 @@ ARG EE_PORTS
# && ln -s /usr/local/openresty/luajit/bin/luajit /usr/local/bin/lua \
# && ln -s /usr/local/openresty/nginx/sbin/nginx /usr/local/bin/nginx \
# && kong version \
# && apt-get purge curl -y

# Uncomment the following section if you are installing a .deb.tar.gz
# Edit the DOWNLOAD_URL line to install from a repository other than
# download.konghq.com
# RUN set -ex; \
# deb add bash curl ca-certificates; \
# arch="$(deb --print-arch)"; \
# case "${arch}" in \
# x86_64) export ARCH='amd64'; KONG_SHA256=$KONG_AMD64_SHA ;; \
# aarch64) export ARCH='arm64'; KONG_SHA256=$KONG_ARM64_SHA ;; \
# esac; \
# if [ "$ASSET" = "remote" ] ; then \
# curl -fL "https://download.konghq.com/gateway-${KONG_VERSION%%.*}.x-ubuntu/kong-${KONG_VERSION}.${ARCH}.deb.tar.gz" -o /tmp/kong.deb.tar.gz \
# && echo "$KONG_SHA256 /tmp/kong.deb.tar.gz" | sha256sum -c -; \
# fi \
# && deb add --no-cache --virtual .build-deps tar gzip \
# && tar -C / -xzf /tmp/kong.deb.tar.gz \
# && deb add --no-cache libstdc++ libgcc openssl pcre perl tzdata libcap zlib zlib-dev bash \
# && adduser -S kong \
# && addgroup -S kong \
# && mkdir -p "/usr/local/kong" \
# && chown -R kong:0 /usr/local/kong \
# && chown kong:0 /usr/local/bin/kong \
# && chmod -R g=u /usr/local/kong \
# && 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 \
# && deb del .build-deps \
# && kong version
kikito marked this conversation as resolved.
Show resolved Hide resolved
# && apt-get purge curl -y

COPY docker-entrypoint.sh /docker-entrypoint.sh

Expand Down
9 changes: 5 additions & 4 deletions ubuntu/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ ARG EE_PORTS

COPY kong.deb /tmp/kong.deb

ARG KONG_VERSION=3.6.1
ARG KONG_VERSION=3.7.0
ENV KONG_VERSION $KONG_VERSION

ARG KONG_AMD64_SHA="03b2aca93fd41b8dc0908754cef815433c1d3069ac842a1d078ca98105b230fd"
ARG KONG_ARM64_SHA="b544bfe2ba4109335d26efb5e59029450f823c3a19b6aef77f6c93d5850142b0"
ARG KONG_AMD64_SHA="71b946cac188653eb29714f21b98eb146cec536e05a5818a49007f9211e572d4"
ARG KONG_ARM64_SHA="fb01282dfe9bf42ba27df30c2bc269aadac3ae3f298ba535f77b15a7bff2f6df"

# hadolint ignore=DL3015
RUN set -ex; \
Expand All @@ -26,7 +26,8 @@ RUN set -ex; \
&& if [ "$ASSET" = "ce" ] ; then \
apt-get install -y --no-install-recommends curl ca-certificates \
&& 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 \
&& KONG_REPO=$(echo ${KONG_VERSION%.*} | sed 's/\.//') \
&& 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 \
&& apt-get purge -y curl \
&& echo "$KONG_SHA256 /tmp/kong.deb" | sha256sum -c - \
|| exit 1; \
Expand Down
3 changes: 2 additions & 1 deletion update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,11 @@ function get_url() {

eval $args

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

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

eval echo $raw_url
Expand Down
Loading