-
Notifications
You must be signed in to change notification settings - Fork 3
Building Kong on s390x
The instructions provided below specify the steps to build a docker image for Kong version 2.1.4 or Kong 'next' on Linux on IBM Z for the following distributions:
- Ubuntu (18.04)
If you do not need a custom build of Kong on s390x, you may opt for the multi-arch alpine docker image docker.io/linuxforhealth/kong:2.1.4 which supports amd64, arm64 and s390x.
Note:
When following the steps below you will need access to the docker command and may therefore need to sudo su
.
Clone the LinuxForHealth kong, kong-build-tools and docker-kong repositories:
git clone https://github.com/LinuxForHealth/kong.git
git clone https://github.com/LinuxForHealth/kong-build-tools.git
git clone https://github.com/LinuxForHealth/docker-kong.git
Clone the repos so that kong, kong-build-tools and docker-kong are at the same directory level. The kong-build-tools and docker-kong repos contain the s390x build modifications. The kong repo contains no modifications, but is at the current tested level of the Kong next branch for s390x builds.
If you are building against Kong 2.1.4, check out the Kong 2.1.4 tagged release:
cd kong
git checkout tags/2.1.4
If you are building against the Kong next branch, check out the Kong next branch:
cd kong
git checkout next
Navigate to Dockerfile.openresty and set the correct Openresty version for your build.
cd kong-build-tools/dockerfiles
Edit Dockerfile.openresty and navigate to line 70.
If you are building against Kong 2.1.4, set ARG RESTY_VERSION=1.15.8.3
If you are building against Kong next, set ARG RESTY_VERSION=1.17.8.2
Navigate to the kong-build-tools Makefile and set your Docker Hub repository.
cd ../kong-build-tools
Edit Makefile
If you are building against Kong 2.1.4, navigate to line 95.
If you are building against Kong next, navigate to line 79.
Set DOCKER_REPOSITORY to your docker repository, e.g. <your_id>/kong
From the kong-build-tools directory, build the apk for the alpine image.
make package-kong
This build will take several minutes. At the end of the build, copy the resulting apk file to docker-kong.
cp output/* ../docker-kong/alpine
Navigate to the docker-kong repo, change the name of the apk file and build the kong docker image.
cd ../docker-kong/alpine
mv kong-2.1.4.s390x.apk.tar.gz kong.tar.gz
cd ..
make build
The result of this build will be a local docker image tagged kong-alpine:latest
. Find the id of this image, then tag this file with your own info and push to your Docker Hub repo.
docker images
docker tag <image_id> <your_docker_id>/kong:2.1.4-s390x
docker push <your_docker_id>/kong:2.1.4-s390x
Congratulations! You have now built Kong on s390x. If you need a multi-arch docker image, continue on to the next optional step.
(Optional) To create your own multi-arch image, extract the amd64 and arm64 images from the official Kong Docker Hub images by running docker pull on the respective platforms and push these images to your own repo. Then put the images together into a single multi-arch image using docker manifest:
docker manifest create \
<your_docker_id>/kong:2.1.4 \
--amend <your_docker_id>/kong:2.1.4-s390x \
--amend <your_docker_id>/kong:2.1.4-amd64 \
--amend <your_docker_id>/kong:2.1.4-arm64
Navigate to kong-build-tools and run the rests.
cd ../kong-build-tools
make test-kong
The information provided in this article is accurate at the time of writing, but on-going development in the open-source projects involved may make the information incorrect or obsolete. Please open an issue in the LinuxForHealth/kong-build-tools repo if you have any questions or feedback.