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

fix(ci): docker-compose -> docker compose #709

Merged
merged 8 commits into from
Jun 25, 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
8 changes: 4 additions & 4 deletions Dockerfile.apk
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ RUN set -ex; \
&& chown kong:0 /usr/local/bin/kong \
&& chmod -R g=u ${KONG_PREFIX} \
&& 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 \
&& ln -sf /usr/local/openresty/bin/resty /usr/local/bin/resty \
&& ln -sf /usr/local/openresty/luajit/bin/luajit /usr/local/bin/luajit \
&& ln -sf /usr/local/openresty/luajit/bin/luajit /usr/local/bin/lua \
&& ln -sf /usr/local/openresty/nginx/sbin/nginx /usr/local/bin/nginx \
&& apk del .build-deps \
&& kong version

Expand Down
20 changes: 13 additions & 7 deletions Dockerfile.deb
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
FROM debian:bullseye-slim

ARG KONG_VERSION=2.8.4
ARG KONG_VERSION=2.8.5
ENV KONG_VERSION $KONG_VERSION

ARG KONG_SHA256="28f7f215a097612f35d3ae86d35c3fbb24a1454a7529f500e2341d5764a5d8a5"
ARG KONG_SHA256="9ae11fb9e748caaf564e825b4cbfd58a25a6ccbf0d6a470174c2138680a8f7a3"

ARG KONG_PREFIX=/usr/local/kong
ENV KONG_PREFIX $KONG_PREFIX
Expand All @@ -25,15 +25,21 @@ RUN set -ex; \
&& echo "${KONG_SHA256} /tmp/kong.deb" | sha256sum -c -; \
fi \
&& apt-get update \
&& apt-get install --yes /tmp/kong.deb \
&& apt-get install --yes /tmp/kong.deb lua5.1 liblua5.1-dev unzip make \
&& curl -L https://luarocks.org/releases/luarocks-3.8.0.tar.gz -o luarocks-3.8.0.tar.gz \
&& tar zxpf luarocks-3.8.0.tar.gz \
&& cd luarocks-3.8.0 \
&& ./configure && make && make install \
&& export PATH=$PATH:/usr/local/bin/luarocks \
&& cd - \
&& rm -rf /var/lib/apt/lists/* \
&& rm -rf /tmp/kong.deb \
&& chown kong:0 /usr/local/bin/kong \
&& chown -R kong:0 ${KONG_PREFIX} \
&& 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 \
&& ln -sf /usr/local/openresty/bin/resty /usr/local/bin/resty \
&& ln -sf /usr/local/openresty/luajit/bin/luajit /usr/local/bin/luajit \
&& ln -sf /usr/local/openresty/luajit/bin/luajit /usr/local/bin/lua \
&& ln -sf /usr/local/openresty/nginx/sbin/nginx /usr/local/bin/nginx \
&& kong version \
&& apt-get purge curl -y

Expand Down
23 changes: 16 additions & 7 deletions Dockerfile.rpm
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
FROM redhat/ubi8

ARG KONG_VERSION=2.8.4
ARG KONG_VERSION=2.8.5
ENV KONG_VERSION $KONG_VERSION

ARG KONG_SHA256="5d3e2712dd4d6b2b3adbe9bafdadd1f15f1f9c89256f9c24d339e4f44f9cc94d"
ARG KONG_SHA256="2e82cc14aef707796c952d38c835c9e0abc0e3ccdc94f1d752118699a62672fb"

ARG KONG_PREFIX=/usr/local/kong
ENV KONG_PREFIX $KONG_PREFIX
Expand All @@ -22,14 +22,23 @@ RUN set -ex; \
curl -fL $DOWNLOAD_URL -o /tmp/kong.rpm \
&& echo "${KONG_SHA256} /tmp/kong.rpm" | sha256sum -c -; \
fi \
&& yum install -y /tmp/kong.rpm \
&& yum install -y /tmp/kong.rpm wget gcc make ncurses-devel \
&& wget https://ftp.gnu.org/gnu/readline/readline-8.2-rc4.tar.gz \
&& tar zxvf readline-8.2-rc4.tar.gz && cd readline-8.2-rc4 && ./configure && make && make install && cd - \
&& export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH \
&& wget https://www.lua.org/ftp/lua-5.1.5.tar.gz && tar -zxvf lua-5.1.5.tar.gz \
&& cd lua-5.1.5 && make linux && make linux install && cd - \
&& wget https://luarocks.org/releases/luarocks-3.8.0.tar.gz && tar zxpf luarocks-3.8.0.tar.gz \
&& cd luarocks-3.8.0 && ./configure && make && make install && cd -\
&& export PATH=$PATH:/usr/local/bin/luarocks \
&& rm /tmp/kong.rpm \
&& chown kong:0 /usr/local/bin/kong \
&& chown -R kong:0 "$KONG_PREFIX" \
&& 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 \
&& ln -sf /usr/lib64/libz.so.1 /usr/lib64/libz.so \
&& ln -sf /usr/local/openresty/bin/resty /usr/local/bin/resty \
&& ln -sf /usr/local/openresty/luajit/bin/luajit /usr/local/bin/luajit \
&& ln -sf /usr/local/openresty/luajit/bin/luajit /usr/local/bin/lua \
&& ln -sf /usr/local/openresty/nginx/sbin/nginx /usr/local/bin/nginx \
&& kong version

COPY docker-entrypoint.sh /docker-entrypoint.sh
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# 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.25.5
KONG_BUILD_TOOLS?=4.40.1
PACKAGE?=apk
BASE?=alpine
ASSET_LOCATION?=remote
Expand Down
8 changes: 4 additions & 4 deletions alpine/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ RUN set -eux; \
&& 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 \
&& ln -sf /usr/local/openresty/bin/resty /usr/local/bin/resty \
&& ln -sf /usr/local/openresty/luajit/bin/luajit /usr/local/bin/luajit \
&& ln -sf /usr/local/openresty/luajit/bin/luajit /usr/local/bin/lua \
&& ln -sf /usr/local/openresty/nginx/sbin/nginx /usr/local/bin/nginx \
&& if [ "$ASSET" = "ce" ] ; then \
kong version; \
fi
Expand Down
9 changes: 5 additions & 4 deletions centos/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,11 @@ RUN set -ex; \
&& rm /tmp/kong.rpm \
&& chown kong:0 /usr/local/bin/kong \
&& chown -R kong:0 /usr/local/kong \
&& 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 \
&& ln -sf /usr/lib64/libz.so.1 /usr/lib64/libz.so \
&& ln -sf /usr/local/openresty/bin/resty /usr/local/bin/resty \
&& ln -sf /usr/local/openresty/luajit/bin/luajit /usr/local/bin/luajit \
&& ln -sf /usr/local/openresty/luajit/bin/luajit /usr/local/bin/lua \
&& ln -sf /usr/local/openresty/nginx/sbin/nginx /usr/local/bin/nginx \
&& if [ "$ASSET" = "ce" ] ; then \
kong version; \
fi
Expand Down
8 changes: 4 additions & 4 deletions compose/Makefile
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
kong-postgres:
COMPOSE_PROFILES=database KONG_DATABASE=postgres docker-compose up -d
COMPOSE_PROFILES=database KONG_DATABASE=postgres docker compose up -d

kong-dbless:
docker-compose up -d
docker compose up -d

clean:
docker-compose kill
docker-compose rm -f
docker compose kill
docker compose rm -f
4 changes: 2 additions & 2 deletions compose/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ This Docker Compose template provisions a Kong container with a Postgres databas
To run this template execute:

```shell
$ docker-compose up
$ docker compose up
```

To scale Kong (ie, to three instances) execute:

```shell
$ docker-compose scale kong=3
$ docker compose scale kong=3
```

Kong will be available through the `nginx-lb` instance on port `8000`, and `8001`. You can customize the template with your own environment variables or datastore configuration.
Expand Down
9 changes: 5 additions & 4 deletions rhel/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,11 @@ RUN set -ex; \
&& rm /tmp/kong.rpm \
&& chown kong:0 /usr/local/bin/kong \
&& chown -R kong:0 /usr/local/kong \
&& 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 \
&& ln -sf /usr/lib64/libz.so.1 /usr/lib64/libz.so \
&& ln -sf /usr/local/openresty/bin/resty /usr/local/bin/resty \
&& ln -sf /usr/local/openresty/luajit/bin/luajit /usr/local/bin/luajit \
&& ln -sf /usr/local/openresty/luajit/bin/luajit /usr/local/bin/lua \
&& ln -sf /usr/local/openresty/nginx/sbin/nginx /usr/local/bin/nginx \
&& if [ "$ASSET" = "ce" ] ; then \
kong version ; \
fi
Expand Down
38 changes: 19 additions & 19 deletions tests/01-image.test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ function run_test {
if [[ -f Dockerfile.$BASE ]]; then
docker run -i --rm -v $PWD/hadolint.yaml:/.config/hadolint.yaml hadolint/hadolint:2.7.0 < Dockerfile.$BASE
fi

if [[ -f $BASE/Dockerfile ]]; then
docker run -i --rm -v $PWD/hadolint.yaml:/.config/hadolint.yaml hadolint/hadolint:2.7.0 < $BASE/Dockerfile
fi
Expand All @@ -23,11 +23,11 @@ function run_test {
if [[ -f Dockerfile.$BASE ]]; then
version_given="$(grep 'ARG KONG_VERSION' Dockerfile.$BASE | awk -F "=" '{print $2}')"
fi

if [[ -f $BASE/Dockerfile ]]; then
version_given="$(grep 'ARG KONG_VERSION' $BASE/Dockerfile | awk -F "=" '{print $2}')"
fi

version_built="$(docker run -i --rm kong-$BASE kong version | tr -d '[:space:]')"

if [[ "$version_given" != "$version_built" ]]; then
Expand All @@ -40,24 +40,24 @@ function run_test {
fi

ttest "Dbless Test"

pushd compose
docker-compose up -d
docker compose up -d
until docker ps -f health=healthy | grep -q ${KONG_DOCKER_TAG}; do
docker-compose up -d
docker compose up -d
docker ps
sleep 15
done

curl -I localhost:8001 | grep -E '(openresty|kong)'
if [ $? -eq 0 ]; then
tsuccess
else
tfailure
fi
docker-compose kill
docker-compose rm -f

docker compose kill
docker compose rm -f
sleep 5
docker volume prune -f
popd
Expand All @@ -67,19 +67,19 @@ function run_test {
export COMPOSE_PROFILES=database
export KONG_DATABASE=postgres
pushd compose
curl -fsSL https://raw.githubusercontent.com/Kong/docker-kong/1.5.0/swarm/docker-compose.yml | KONG_DOCKER_TAG=kong:1.5.0 docker-compose -p kong -f - up -d
curl -fsSL https://raw.githubusercontent.com/Kong/docker-kong/1.5.0/swarm/docker-compose.yml | KONG_DOCKER_TAG=kong:1.5.0 docker compose -p kong -f - up -d
until docker ps -f health=healthy | grep -q kong:1.5.0; do
curl -fsSL https://raw.githubusercontent.com/Kong/docker-kong/1.5.0/swarm/docker-compose.yml | docker-compose -p kong -f - ps
curl -fsSL https://raw.githubusercontent.com/Kong/docker-kong/1.5.0/swarm/docker-compose.yml | docker compose -p kong -f - ps
docker ps
sleep 15
curl -fsSL https://raw.githubusercontent.com/Kong/docker-kong/1.5.0/swarm/docker-compose.yml | KONG_DOCKER_TAG=kong:1.5.0 docker-compose -p kong -f - up -d
curl -fsSL https://raw.githubusercontent.com/Kong/docker-kong/1.5.0/swarm/docker-compose.yml | KONG_DOCKER_TAG=kong:1.5.0 docker compose -p kong -f - up -d
done
curl -I localhost:8001 | grep 'Server: openresty'
sed -i -e 's/127.0.0.1://g' docker-compose.yml
KONG_DOCKER_TAG=${KONG_DOCKER_TAG} docker-compose -p kong up -d

KONG_DOCKER_TAG=${KONG_DOCKER_TAG} docker compose -p kong up -d
until docker ps -f health=healthy | grep -q ${KONG_DOCKER_TAG}; do
docker-compose -p kong ps
docker compose -p kong ps
docker ps
sleep 15
done
Expand All @@ -90,11 +90,11 @@ function run_test {
else
tfailure
fi

echo "cleanup"

docker-compose -p kong kill
docker-compose -p kong rm -f
docker compose -p kong kill
docker compose -p kong rm -f
sleep 5
docker volume prune -f
docker system prune -y
Expand Down
14 changes: 7 additions & 7 deletions ubuntu/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ ARG EE_PORTS

COPY kong.deb /tmp/kong.deb

ARG KONG_VERSION=2.8.4
ARG KONG_VERSION=2.8.5
ENV KONG_VERSION $KONG_VERSION

ARG KONG_AMD64_SHA="e4bc62c80f717114cc486776ee453931c5de0e8eaf0901ac11dbb4b2bae14534"
ARG KONG_AMD64_SHA="efba2bb8b1cb567bc90cc371e80503c558cbc74377b34609552ae2273def3fe3"
ARG KONG_ARM64_SHA="4fff44f9a0c7b06469591b7d1499a99a100109bc3f08dc412dd0eb38ff383d35"

# hadolint ignore=DL3015
Expand All @@ -36,15 +36,15 @@ RUN set -ex; \
# Please update the ubuntu install docs if the below line is changed so that
# end users can properly install Kong along with its required dependencies
# and that our CI does not diverge from our docs.
&& apt install --yes /tmp/kong.deb \
&& apt install --yes /tmp/kong.deb luarocks\
&& rm -rf /var/lib/apt/lists/* \
&& rm -rf /tmp/kong.deb \
&& chown kong:0 /usr/local/bin/kong \
&& chown -R kong:0 /usr/local/kong \
&& 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 \
&& ln -sf /usr/local/openresty/bin/resty /usr/local/bin/resty \
&& ln -sf /usr/local/openresty/luajit/bin/luajit /usr/local/bin/luajit \
&& ln -sf /usr/local/openresty/luajit/bin/luajit /usr/local/bin/lua \
&& ln -sf /usr/local/openresty/nginx/sbin/nginx /usr/local/bin/nginx \
&& if [ "$ASSET" = "ce" ] ; then \
kong version ; \
fi
Expand Down
52 changes: 8 additions & 44 deletions update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,56 +34,26 @@ function get_url() {

eval $args

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

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

eval echo $raw_url
}


hub --version &> /dev/null || die "hub is not in PATH. Get it from https://github.com/github/hub"

kbt_in_kong_v=$(curl -sL https://raw.githubusercontent.com/Kong/kong/$version/.requirements | grep 'KONG_BUILD_TOOLS_VERSION\=' | awk -F"=" '{print $2}' | tr -d "'[:space:]")
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

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

url=$(get_url Dockerfile arm64)
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

sed -i.bak 's/ARG KONG_ARM64_SHA=.*/ARG KONG_ARM64_SHA=\"'$new_sha'\"/g' ../Dockerfile.apk
sed -i.bak 's/ARG KONG_VERSION=.*/ARG KONG_VERSION='$version'/g' ../Dockerfile.apk
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

url=$(get_url Dockerfile.rpm amd64 "VERSION=8")
# Dockerfile.rpm
url=$(get_url Dockerfile.rpm x86_64 "VERSION=8")
echo $url
curl -fL $url -o /tmp/kong
new_sha=$(sha256sum /tmp/kong | cut -b1-64)
Expand All @@ -92,23 +62,17 @@ sed -i.bak 's/ARG KONG_SHA256=.*/ARG KONG_SHA256=\"'$new_sha'\"/g' Dockerfile.rp
sed -i.bak 's/ARG KONG_VERSION=.*/ARG KONG_VERSION='$version'/g' Dockerfile.rpm

pushd ubuntu
url=$(get_url Dockerfile amd64 "UBUNTU_CODENAME=bionic")
url=$(get_url Dockerfile amd64 "CODENAME=jammy")
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

url=$(get_url Dockerfile arm64 "UBUNTU_CODENAME=bionic")
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

# Dockerfile.deb
url=$(get_url Dockerfile.deb amd64 "CODENAME=bullseye")
echo $url
curl -fL $url -o /tmp/kong
Expand Down
Loading