diff --git a/.env b/.env index 5e576c4..f5d3006 100644 --- a/.env +++ b/.env @@ -4,4 +4,4 @@ PCRE_VERSION=8.45 KONG_NGINX_MODULE_VERSION=0.4.0 LUA_RESTY_LMDB_VERSION=1.0.0 LUA_RESTY_EVENTS_VERSION=0.1.3 -ATC_ROUTER_VERSION=1.0.35 +ATC_ROUTER_VERSION=1.4.9 diff --git a/Dockerfile b/Dockerfile index 99d3967..bc16c9a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,10 +4,10 @@ ARG DOCKER_REGISTRY=ghcr.io ARG DOCKER_IMAGE_NAME # List out all image permutations to trick dependabot -FROM --platform=linux/amd64 ghcr.io/kong/kong-openssl:1.1.3-x86_64-linux-musl as x86_64-linux-musl -FROM --platform=linux/amd64 ghcr.io/kong/kong-openssl:1.1.3-x86_64-linux-gnu as x86_64-linux-gnu -FROM --platform=linux/arm64 ghcr.io/kong/kong-openssl:1.1.3-aarch64-linux-musl as aarch64-linux-musl -FROM --platform=linux/arm64 ghcr.io/kong/kong-openssl:1.1.3-aarch64-linux-gnu as aarch64-linux-gnu +FROM --platform=linux/amd64 ghcr.io/kong/kong-openssl:1.1.5-x86_64-linux-musl as x86_64-linux-musl +FROM --platform=linux/amd64 ghcr.io/kong/kong-openssl:1.1.5-x86_64-linux-gnu as x86_64-linux-gnu +FROM --platform=linux/arm64 ghcr.io/kong/kong-openssl:1.1.5-aarch64-linux-musl as aarch64-linux-musl +FROM --platform=linux/arm64 ghcr.io/kong/kong-openssl:1.1.5-aarch64-linux-gnu as aarch64-linux-gnu # Run the build script @@ -16,7 +16,18 @@ FROM $ARCHITECTURE-$OSTYPE as build COPY . /tmp WORKDIR /tmp -RUN /tmp/build.sh +# Run our predecessor tests +# Configure, build, and install +# Run our own tests +# Re-run our predecessor tests +RUN /test/*/test.sh && \ + /tmp/build.sh && \ + /tmp/test.sh && \ + /test/*/test.sh + +# Test scripts left where downstream images can run them +COPY test.sh /test/kong-runtime/test.sh +COPY .env /test/kong-runtime/.env # Copy the build result to scratch so we can export the result FROM scratch as package diff --git a/build.sh b/build.sh index cabf9c8..cfa6ed0 100755 --- a/build.sh +++ b/build.sh @@ -10,6 +10,7 @@ SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) export $(grep -v '^#' $SCRIPT_DIR/.env | xargs) function main() { + echo '--- installing kong runtime ---' with_backoff curl --fail -sSLo pcre.tar.gz "https://downloads.sourceforge.net/project/pcre/pcre/${PCRE_VERSION}/pcre-${PCRE_VERSION}.tar.gz" tar -xzvf pcre.tar.gz ln -s pcre-${PCRE_VERSION} pcre @@ -39,6 +40,7 @@ function main() { popd pushd openresty-${OPENRESTY_VERSION} + echo '--- installing openresty ---' OPENRESTY_OPTS=( "--prefix=/usr/local/openresty" "--with-pcre-jit" @@ -79,8 +81,10 @@ function main() { pushd /tmp/lua-resty-events make install LUA_LIB_DIR=/tmp/build/usr/local/openresty/lualib popd + echo '--- installed openresty ---' pushd /tmp/luarocks-${LUAROCKS_VERSION} + echo '--- installing luarocks ---' ./configure \ --prefix=/usr/local \ --with-lua=/tmp/build/usr/local/openresty/luajit \ @@ -88,13 +92,14 @@ function main() { make build -j2 make install DESTDIR=/tmp/build + echo '--- installed luarocks ---' popd arch=$(uname -m) package_architecture=x86_64 if [ "$(arch)" == "aarch64" ]; then - package_architecture=aarch64 + package_architecture=aarch64 fi curl -fsSLo atc-router.tar.gz https://github.com/hutchic/atc-router/releases/download/$ATC_ROUTER_VERSION/$package_architecture-unknown-$OSTYPE.tar.gz @@ -105,6 +110,7 @@ function main() { mkdir -p /tmp/build/usr/local/lib/lua sed -i 's/\/tmp\/build//' `grep -l -I -r '\/tmp\/build' /tmp/build/` + echo '--- installed kong runtime ---' } # Retries a command a configurable number of times with backoff. diff --git a/test.sh b/test.sh index 42629ef..e9735e0 100755 --- a/test.sh +++ b/test.sh @@ -10,21 +10,25 @@ SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) export $(grep -v '^#' $SCRIPT_DIR/.env | xargs) function test() { + echo '--- testing kong runtime (openresty, luarocks) ---' cp -R /tmp/build/* / mv /tmp/build /tmp/buffer # Check we didn't link dependencies to `/tmp/build/...` - /usr/local/kong/bin/openssl version # From kong-openssl test.sh - ls -la /usr/local/kong/lib/libyaml.so # From kong-openssl test.sh - /usr/local/openresty/bin/openresty -v 2>&1 | grep -q ${OPENRESTY_VERSION} /usr/local/openresty/bin/openresty -V 2>&1 | grep -q pcre + /usr/local/openresty/bin/openresty -V 2>&1 | grep -q lua-kong-nginx-module + /usr/local/openresty/bin/openresty -V 2>&1 | grep -q lua-resty-lmdb + /usr/local/openresty/bin/openresty -V 2>&1 | grep -q lua-resty-events /usr/local/openresty/bin/resty -e 'print(jit.version)' | grep -q 'LuaJIT[[:space:]][[:digit:]]\+.[[:digit:]]\+.[[:digit:]]\+-[[:digit:]]\{8\}' ls -l /usr/local/openresty/lualib/resty/websocket/*.lua grep _VERSION /usr/local/openresty/lualib/resty/websocket/*.lua luarocks --version + ldd /usr/local/openresty/lualib/libatc_router.so + mv /tmp/buffer /tmp/build + echo '--- tested kong runtime ---' } test