Skip to content

Commit

Permalink
Revert "chore(*): make this repo a thin wrapper of Kong docker images" (
Browse files Browse the repository at this point in the history
  • Loading branch information
kikito authored Jul 14, 2023
1 parent 3d3068a commit 4a31250
Show file tree
Hide file tree
Showing 14 changed files with 550 additions and 33 deletions.
35 changes: 32 additions & 3 deletions Dockerfile.apk
Original file line number Diff line number Diff line change
@@ -1,21 +1,50 @@
# When you update this file substantially, please update build_your_own_images.md as well.
FROM kong/kong:3.3.0-alpine@sha256:56499004203a618ab19aceca85e6611d3baba731b9577da27dee6bb6c8187cf5
FROM alpine:3.17

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

ARG KONG_VERSION=3.3.0
ENV KONG_VERSION $KONG_VERSION

ARG KONG_AMD64_SHA="494522d5ef9baf674272bbb7075e406a4515a7475253fd3026cc7ca9451612a2"

ARG KONG_PREFIX=/usr/local/kong
ENV KONG_PREFIX $KONG_PREFIX

ARG ASSET=remote
ARG EE_PORTS

RUN kong version
COPY kong.apk.tar.gz /tmp/kong.apk.tar.gz

RUN set -ex; \
apk add --virtual .build-deps curl tar gzip ca-certificates; \
export ARCH='amd64'; \
KONG_SHA256=$KONG_AMD64_SHA ; \
if [ "$ASSET" = "remote" ] ; then \
curl -fL "https://download.konghq.com/gateway-${KONG_VERSION%%.*}.x-alpine/kong-${KONG_VERSION}.${ARCH}.apk.tar.gz" -o /tmp/kong.apk.tar.gz \
&& echo "$KONG_SHA256 /tmp/kong.apk.tar.gz" | sha256sum -c -; \
fi \
&& tar -C / -xzf /tmp/kong.apk.tar.gz \
&& apk add --no-cache libstdc++ libgcc perl tzdata libcap zlib zlib-dev bash yaml \
&& adduser -S kong \
&& addgroup -S kong \
&& mkdir -p "${KONG_PREFIX}" \
&& chown -R kong:0 ${KONG_PREFIX} \
&& chown kong:0 /usr/local/bin/kong \
&& chmod -R g=u ${KONG_PREFIX} \
&& rm -rf /tmp/kong.apk.tar.gz \
&& 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

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

USER kong

ENTRYPOINT ["/entrypoint.sh"]
ENTRYPOINT ["/docker-entrypoint.sh"]

EXPOSE 8000 8443 8001 8444 $EE_PORTS

Expand Down
35 changes: 31 additions & 4 deletions Dockerfile.deb
Original file line number Diff line number Diff line change
@@ -1,26 +1,53 @@
# When you update this file substantially, please update build_your_own_images.md as well.
FROM kong/kong:3.3.0-ubuntu@sha256:b476a8eacb0025fea9b7d3220990eb9b785c2ff24ef5f84f8bb2c0fbcb17254d
FROM debian:bullseye-20230502-slim

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

ARG KONG_VERSION=3.3.0
ENV KONG_VERSION $KONG_VERSION

ARG KONG_SHA256="2fcfaa2095d2eb9dc91820f2f5f0e623b0b8a7457ddcb6ddf5761f4cb02d14e9"

ARG KONG_PREFIX=/usr/local/kong
ENV KONG_PREFIX $KONG_PREFIX

ARG ASSET=remote
ARG EE_PORTS

RUN kong version
COPY kong.deb /tmp/kong.deb

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-debian-${CODENAME}/pool/all/k/kong/kong_${KONG_VERSION}_amd64.deb" \
&& curl -fL $DOWNLOAD_URL -o /tmp/kong.deb \
&& echo "$KONG_SHA256 /tmp/kong.deb" | sha256sum -c -; \
fi \
&& apt-get update \
&& apt-get install --yes /tmp/kong.deb \
&& 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 -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

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

USER kong

ENTRYPOINT ["/entrypoint.sh"]
ENTRYPOINT ["/docker-entrypoint.sh"]

EXPOSE 8000 8443 8001 8444 $EE_PORTS

STOPSIGNAL SIGQUIT

HEALTHCHECK --interval=60s --timeout=10s --retries=10 CMD kong-health

CMD ["kong", "docker-start"]
CMD ["kong", "docker-start"]
55 changes: 51 additions & 4 deletions Dockerfile.rpm
Original file line number Diff line number Diff line change
@@ -1,26 +1,73 @@
# When you update this file substantially, please update build_your_own_images.md as well.
FROM kong/kong:3.3.0-rhel@sha256:f606d839f607634f89adbcd8d701912c8a0b7195dd60940a03b70bfb59e90d11
FROM registry.access.redhat.com/ubi8/ubi-minimal:8.7@sha256:6910799b75ad41f00891978575a0d955be2f800c51b955af73926e7ab59a41c3

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

ARG KONG_VERSION=3.3.0
ENV KONG_VERSION $KONG_VERSION

# RedHat required labels
LABEL name="Kong" \
vendor="Kong" \
version="$KONG_VERSION" \
release="1" \
url="https://konghq.com" \
summary="Next-Generation API Platform for Modern Architectures" \
description="Next-Generation API Platform for Modern Architectures"

# RedHat required LICENSE file approved path
COPY LICENSE /licenses/

ARG KONG_SHA256="d5aef8421e962b97bb734bacb443ddf40733acfad61bf3cf97611619c348b2f6"

ARG KONG_PREFIX=/usr/local/kong
ENV KONG_PREFIX $KONG_PREFIX

ARG ASSET=remote
ARG EE_PORTS

RUN kong version
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" \
&& curl -fL $DOWNLOAD_URL -o /tmp/kong.rpm \
&& echo "$KONG_SHA256 /tmp/kong.rpm" | sha256sum -c - \
|| exit 1; \
fi \
# findutils provides xargs (temporarily)
&& microdnf install --assumeyes --nodocs \
findutils \
shadow-utils \
unzip \
&& rpm -qpR /tmp/kong.rpm \
| grep -v rpmlib \
| xargs -n1 -t microdnf install --assumeyes --nodocs \
# Please update the rhel 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.
&& rpm -iv /tmp/kong.rpm \
&& microdnf -y clean all \
&& rm /tmp/kong.rpm \
&& chown kong:0 /usr/local/bin/kong \
&& chown -R kong:0 ${KONG_PREFIX} \
&& 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

USER kong

ENTRYPOINT ["/entrypoint.sh"]
ENTRYPOINT ["/docker-entrypoint.sh"]

EXPOSE 8000 8443 8001 8444 $EE_PORTS

STOPSIGNAL SIGQUIT

HEALTHCHECK --interval=60s --timeout=10s --retries=10 CMD kong-health

CMD ["kong", "docker-start"]
CMD ["kong", "docker-start"]
12 changes: 12 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ BASE?=alpine
DOCKER_TAG_PREFIX?=kong

KONG_VERSION?=
KONG_SHA256?=

# these two flags cannot be specified in this makefile <at all> if the default
# values from the Dockerfiles are desired
Expand All @@ -20,6 +21,11 @@ else
KONG_VERSION_FLAG:=--build-arg KONG_VERSION=$(KONG_VERSION)
endif

ifeq ($(strip $(KONG_SHA256)),)
KONG_SHA256_FLAG:=
else
KONG_SHA256_FLAG:=--build-arg KONG_SHA256=$(KONG_SHA256)
endif

RHEL_REGISTRY_KEY?=
RHEL_REGISTRY?=scan.connect.redhat.com
Expand All @@ -33,19 +39,25 @@ else
DOCKER_TAG?=$(DOCKER_TAG_PREFIX)-$(BASE)
endif

build: ASSET_LOCATION?=ce
build:
docker build \
--no-cache \
--build-arg ASSET=$(ASSET_LOCATION) \
$(KONG_VERSION_FLAG) \
$(KONG_SHA256_FLAG) \
-t $(DOCKER_TAG) \
$(BASE)/

# (yzl, 14 June 2022) Should you change this substantially, please update build_your_own_images.md.
build_v2: ASSET_LOCATION?=remote
build_v2:
docker image inspect -f='{{.Id}}' $(DOCKER_TAG) || \
docker build \
--no-cache \
--build-arg ASSET=$(ASSET_LOCATION) \
$(KONG_VERSION_FLAG) \
$(KONG_SHA256_FLAG) \
-t $(DOCKER_TAG) \
-f Dockerfile.$(PACKAGE) \
.
Expand Down
4 changes: 0 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@ See [the Docker Hub page](https://registry.hub.docker.com/_/kong/)
for the full readme on how to use this Docker image and for information
regarding contributing and issues.

For nightly and release Docker images built by Kong and to build your own docker images from packages,
use [Kong dockerfiles](https://github.com/Kong/kong/tree/master/build/dockerfiles), and [kong/kong]
(https://registry.hub.docker.com/r/kong/kong) from Dockerhub.

The full readme is generated over in [docker-library/docs](https://github.com/docker-library/docs),
specifically in [docker-library/docs/kong](https://github.com/docker-library/docs/tree/master/kong).

Expand Down
Loading

0 comments on commit 4a31250

Please sign in to comment.