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

Add official image for KrakenD Api Gateway #13592

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

taik0
Copy link

@taik0 taik0 commented Nov 25, 2022

Signed-off-by: Daniel Ortiz [email protected]

KrakenD is a stateless Open Source API Gateway built on top of the Lura Framework (formerly KrakenD Framework).
To know more about KrakenD, please read our documentation

https://github.com/krakendio/krakend-ce

Checklist for Review

NOTE: This checklist is intended for the use of the Official Images maintainers both to track the status of your PR and to help inform you and others of where we're at. As such, please leave the "checking" of items to the repository maintainers. If there is a point below for which you would like to provide additional information or note completion, please do so by commenting on the PR. Thanks! (and thanks for staying patient with us ❤️)

  • associated with or contacted upstream?
  • available under an OSI-approved license?
  • does it fit into one of the common categories? ("service", "language stack", "base distribution")
  • is it reasonably popular, or does it solve a particular use case well?
  • does a documentation PR exist? (should be reviewed and merged at roughly the same time so that we don't have an empty image page on the Hub for very long)
  • official-images maintainer dockerization review for best practices and cache gotchas/improvements (ala the official review guidelines)?
  • 2+ official-images maintainer dockerization review?
  • existing official images have been considered as a base? (ie, if foobar needs Node.js, has FROM node:... instead of grabbing node via other means been considered?)
  • if FROM scratch, tarballs only exist in a single commit within the associated history?
  • passes current tests? any simple new tests that might be appropriate to add? (https://github.com/docker-library/official-images/tree/master/test)

@taik0
Copy link
Author

taik0 commented Nov 25, 2022

Documentation PR: docker-library/docs#2082

@taik0
Copy link
Author

taik0 commented Nov 25, 2022

I didn't realize that that repository used the main branch instead of master. I pushed a master branch, so we don't have to change anything on this PR.
A re-run should work now.

@taik0
Copy link
Author

taik0 commented Dec 13, 2022

Hi, there's something in my hand that can be done to unblock this PR?

Thank you!

@yosifkit
Copy link
Member

Hello! ✨

Thanks for your interest in contributing to the official images program. 💭

As you may have noticed, we've usually got a pretty decently sized queue of new images (not to mention image updates and maintenance of images under @docker-library which are maintained by the core official images team). As such, it may be some time before we get to reviewing this image (image updates get priority both because users expect them and because reviewing new images is a more involved process than reviewing updates), so we apologize in advance! Please be patient with us -- rest assured, we've seen your PR and it's in the queue. ❤️

We do try to proactively add and update the "new image checklist" on each PR, so if you haven't looked at it yet, that's a good use of time while you wait. ☔

Thanks! 💖 💙 💚 ❤️

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@JAORMX
Copy link

JAORMX commented Mar 14, 2023

Hey folks! As a krakend user we'd really benefit from getting this PR accepted. The project is growing fast and this would be very beneficial not only for the project itself but for the community that's growing around it.

@github-actions

This comment has been minimized.

This comment has been minimized.

@taik0
Copy link
Author

taik0 commented Dec 14, 2023

Hi team,

Are new images still blocked?

@taik0 taik0 requested a review from a team as a code owner April 23, 2024 12:26

This comment has been minimized.

@taik0
Copy link
Author

taik0 commented Apr 23, 2024

Hi @yosifkit
Is something wrong on our side? There hasn't been any response in almost 1.5 years, are new docker images still being accepted?

@LaurentGoderre
Copy link
Member

I opened a PR to optimize the image: krakend/docker-library#4

Could you also open a docs PR as explained here: https://github.com/docker-library/docs/blob/master/README.md

Copy link

Diff for e5afdd7:
diff --git a/_bashbrew-arches b/_bashbrew-arches
index 8b13789..e85a97f 100644
--- a/_bashbrew-arches
+++ b/_bashbrew-arches
@@ -1 +1,2 @@
-
+amd64
+arm64v8
diff --git a/_bashbrew-cat b/_bashbrew-cat
index bdfae4a..5f60418 100644
--- a/_bashbrew-cat
+++ b/_bashbrew-cat
@@ -1 +1,12 @@
-Maintainers: New Image! :D (@docker-library-bot)
+Maintainers: Daniel Ortiz <[email protected]> (@taik0), Daniel López <[email protected]> (@kpacha)
+GitRepo: https://github.com/krakendio/docker-library.git
+
+Tags: 2.6.2
+Architectures: amd64, arm64v8
+GitCommit: b7b980f989c53a770f4722835c06d1addb81fbbd
+Directory: 2.6.2
+
+Tags: 2.6.3, 2.6, 2, latest
+Architectures: amd64, arm64v8
+GitCommit: b7b980f989c53a770f4722835c06d1addb81fbbd
+Directory: 2.6.3
diff --git a/_bashbrew-list b/_bashbrew-list
index e69de29..cc77abe 100644
--- a/_bashbrew-list
+++ b/_bashbrew-list
@@ -0,0 +1,5 @@
+krakend:2
+krakend:2.6
+krakend:2.6.2
+krakend:2.6.3
+krakend:latest
diff --git a/krakend_2.6.2/Dockerfile b/krakend_2.6.2/Dockerfile
new file mode 100644
index 0000000..4d390e4
--- /dev/null
+++ b/krakend_2.6.2/Dockerfile
@@ -0,0 +1,45 @@
+#
+# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh"
+#
+# PLEASE DO NOT EDIT IT DIRECTLY.
+#
+FROM alpine:3.18
+
+LABEL org.opencontainers.image.authors="[email protected]"
+
+RUN set -eux; \
+	apk add --no-cache --virtual .run-deps ca-certificates su-exec tzdata; \
+	adduser -u 1000 -S -D -H krakend;
+
+RUN set -eux; \
+    apk add --no-cache --virtual .build-deps gnupg; \
+    arch="$(apk --print-arch)"; \
+	case "$arch" in \
+		'x86_64') \
+			export GOARCH='amd64' GOOS='linux'; \
+			export KRAKEND_DOWNLOAD_SHA512=c6ee4fcac397161f3dadd208b8c4a8aa2e4cf65c189086e80c8f4f364f72536c69fb5af7bd9ed273c3c978a82919f773eb32b1a6825078d945359d000c463e74; \
+			;; \
+		'aarch64') \
+			export GOARCH='arm64' GOOS='linux'; \
+			export KRAKEND_DOWNLOAD_SHA512=e9d297f252a6ab4761468dbe058b81ae8bc429f573841cda30bfc1d56900dbcffb8f6fce8eef75cf735d9cdd1ab161ea606f01f23e2a2c264668ec5205b47ecd; \
+			;; \
+		*) echo >&2 "error: unsupported architecture '$TARGETARCH' (likely packaging update needed)"; exit 1 ;; \
+	esac; \
+    wget -O krakend.tar.gz "https://github.com/krakendio/krakend-ce/releases/download/v2.6.2/krakend_2.6.2_${GOARCH}_alpine.tar.gz"; \
+    wget -O krakend.tar.gz.asc "https://github.com/krakendio/krakend-ce/releases/download/v2.6.2/krakend_2.6.2_${GOARCH}_alpine.tar.gz.asc"; \
+    export GNUPGHOME="$(mktemp -d)"; \
+    gpg --batch --keyserver keyserver.ubuntu.com --recv-keys 5B270F2E01E375FD9D5635E25DE6FD698AD6FDD2; \
+    gpg --batch --verify krakend.tar.gz.asc krakend.tar.gz; \
+    tar xzf krakend.tar.gz -C / --strip-components 1; \
+	echo "$KRAKEND_DOWNLOAD_SHA512 *krakend.tar.gz" | sha512sum -c; \
+	rm -f krakend.tar.gz krakend.tar.gz.asc; \
+	apk del --no-network .build-deps; \
+	echo '{ "version": 3 }' > /etc/krakend/krakend.json
+
+WORKDIR /etc/krakend
+
+COPY docker-entrypoint.sh /
+ENTRYPOINT [ "/docker-entrypoint.sh" ]
+
+EXPOSE 8080 8090
+CMD [ "krakend", "run", "-c", "/etc/krakend/krakend.json" ]
diff --git a/krakend_2.6.2/docker-entrypoint.sh b/krakend_2.6.2/docker-entrypoint.sh
new file mode 100755
index 0000000..2b9c5c2
--- /dev/null
+++ b/krakend_2.6.2/docker-entrypoint.sh
@@ -0,0 +1,41 @@
+#!/bin/sh
+set -e
+
+commandRun="run"
+commandVersion="version"
+commandCheck="check"
+commandPlugin="check-plugin"
+commandHelp="help"
+commandValidate="validate"
+commandAudit="audit"
+
+# this if will check if the first argument is a flag
+# but only works if all arguments require a hyphenated flag
+# -v; -SL; -f arg; Also check if the first argument is any
+# of the KrakenD commands
+if [ "$#" -eq 0 ] || [ "${1#-}" != "$1" ] ||
+   [ "$1" = "${commandRun}" ] || 
+   [ "$1" = "${commandVersion}" ] || 
+   [ "$1" = "${commandCheck}" ] || 
+   [ "$1" = "${commandPlugin}" ] ||
+   [ "$1" = "${commandValidate}" ] ||
+   [ "$1" = "${commandAudit}" ] ||
+   [ "$1" = "${commandHelp}" ]; then
+    set -- krakend "$@"
+fi
+
+# check for the expected command
+if [ "$1" = 'krakend' ]; then
+    # krakend user has uid 1000
+    # https://kubernetes.io/docs/tasks/configure-pod-container/security-context/
+    # runAsUser: 1000
+    if [ "$(id -u)" = 1000 ]; then
+        exec "$@"    
+    else
+        # use su-exec to drop to a non-root user
+        exec su-exec krakend "$@"
+    fi
+fi
+
+# else default to run whatever the user wanted like "bash" or "sh"
+exec "$@"
diff --git a/krakend_latest/Dockerfile b/krakend_latest/Dockerfile
new file mode 100644
index 0000000..474c180
--- /dev/null
+++ b/krakend_latest/Dockerfile
@@ -0,0 +1,45 @@
+#
+# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh"
+#
+# PLEASE DO NOT EDIT IT DIRECTLY.
+#
+FROM alpine:3.18
+
+LABEL org.opencontainers.image.authors="[email protected]"
+
+RUN set -eux; \
+	apk add --no-cache --virtual .run-deps ca-certificates su-exec tzdata; \
+	adduser -u 1000 -S -D -H krakend;
+
+RUN set -eux; \
+    apk add --no-cache --virtual .build-deps gnupg; \
+    arch="$(apk --print-arch)"; \
+	case "$arch" in \
+		'x86_64') \
+			export GOARCH='amd64' GOOS='linux'; \
+			export KRAKEND_DOWNLOAD_SHA512=fa1b40247c4e794a651f7dff09647a65e309775fe89d71ac90a2f3afef8767e0614119034c2c9c0d0fabf81b36825ae14d1860269293d36ad0f4ec9b3c2d7065; \
+			;; \
+		'aarch64') \
+			export GOARCH='arm64' GOOS='linux'; \
+			export KRAKEND_DOWNLOAD_SHA512=1334eb6508cf56224e59ce8ff31dd332b8258dd7d9b46fc7c9e0faf996753a950ddb41412e86c1a8f3457fb64f6c2b1b6db40e7f79a2d11c69a684d1c3b93596; \
+			;; \
+		*) echo >&2 "error: unsupported architecture '$TARGETARCH' (likely packaging update needed)"; exit 1 ;; \
+	esac; \
+    wget -O krakend.tar.gz "https://github.com/krakendio/krakend-ce/releases/download/v2.6.3/krakend_2.6.3_${GOARCH}_alpine.tar.gz"; \
+    wget -O krakend.tar.gz.asc "https://github.com/krakendio/krakend-ce/releases/download/v2.6.3/krakend_2.6.3_${GOARCH}_alpine.tar.gz.asc"; \
+    export GNUPGHOME="$(mktemp -d)"; \
+    gpg --batch --keyserver keyserver.ubuntu.com --recv-keys 5B270F2E01E375FD9D5635E25DE6FD698AD6FDD2; \
+    gpg --batch --verify krakend.tar.gz.asc krakend.tar.gz; \
+    tar xzf krakend.tar.gz -C / --strip-components 1; \
+	echo "$KRAKEND_DOWNLOAD_SHA512 *krakend.tar.gz" | sha512sum -c; \
+	rm -f krakend.tar.gz krakend.tar.gz.asc; \
+	apk del --no-network .build-deps; \
+	echo '{ "version": 3 }' > /etc/krakend/krakend.json
+
+WORKDIR /etc/krakend
+
+COPY docker-entrypoint.sh /
+ENTRYPOINT [ "/docker-entrypoint.sh" ]
+
+EXPOSE 8080 8090
+CMD [ "krakend", "run", "-c", "/etc/krakend/krakend.json" ]
diff --git a/krakend_latest/docker-entrypoint.sh b/krakend_latest/docker-entrypoint.sh
new file mode 100755
index 0000000..2b9c5c2
--- /dev/null
+++ b/krakend_latest/docker-entrypoint.sh
@@ -0,0 +1,41 @@
+#!/bin/sh
+set -e
+
+commandRun="run"
+commandVersion="version"
+commandCheck="check"
+commandPlugin="check-plugin"
+commandHelp="help"
+commandValidate="validate"
+commandAudit="audit"
+
+# this if will check if the first argument is a flag
+# but only works if all arguments require a hyphenated flag
+# -v; -SL; -f arg; Also check if the first argument is any
+# of the KrakenD commands
+if [ "$#" -eq 0 ] || [ "${1#-}" != "$1" ] ||
+   [ "$1" = "${commandRun}" ] || 
+   [ "$1" = "${commandVersion}" ] || 
+   [ "$1" = "${commandCheck}" ] || 
+   [ "$1" = "${commandPlugin}" ] ||
+   [ "$1" = "${commandValidate}" ] ||
+   [ "$1" = "${commandAudit}" ] ||
+   [ "$1" = "${commandHelp}" ]; then
+    set -- krakend "$@"
+fi
+
+# check for the expected command
+if [ "$1" = 'krakend' ]; then
+    # krakend user has uid 1000
+    # https://kubernetes.io/docs/tasks/configure-pod-container/security-context/
+    # runAsUser: 1000
+    if [ "$(id -u)" = 1000 ]; then
+        exec "$@"    
+    else
+        # use su-exec to drop to a non-root user
+        exec su-exec krakend "$@"
+    fi
+fi
+
+# else default to run whatever the user wanted like "bash" or "sh"
+exec "$@"

@taik0
Copy link
Author

taik0 commented May 23, 2024

Hi @LaurentGoderre, thank you for the PR, it's already merged.

The doc PR is here docker-library/docs#2082

@LaurentGoderre
Copy link
Member

Small comments on the docs

@alombarte
Copy link

Comments on the docs are addressed. Thank you very much for your review!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants