Last active
May 3, 2025 03:22
-
-
Save bunchc/51cb11b968c6f6fe6ec8b54415360668 to your computer and use it in GitHub Desktop.
Using custom golang plugins with the Kong Ubuntu image
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# To build and load custom GO plugins into the Kong Ubuntu image | |
# we use a multistage docker build. The first stage uses the golang | |
# image to build the plugin. The second stage then copies that plugin | |
# into the Kong Ubuntu image. | |
# Build the golang plugin | |
FROM golang:alpine as build | |
WORKDIR /plugin | |
COPY go-plugins/* ./ | |
RUN go build go-hello.go | |
# Copy the plugin into the kong-gateway image as root: | |
# ref: https://docs.konghq.com/gateway/latest/plugin-development/pluginserver/plugins-kubernetes/ | |
FROM kong/kong-gateway:3.2.2.1-ubuntu | |
USER root | |
COPY --from=build /plugin/go-hello /usr/local/bin/go-hello | |
# Return the image to defaults for runtime | |
USER kong | |
ENTRYPOINT ["/entrypoint.sh"] | |
EXPOSE 8000 8443 8001 8444 | |
STOPSIGNAL SIGQUIT | |
HEALTHCHECK --interval=10s --timeout=10s --retries=10 CMD kong health | |
CMD ["kong", "docker-start"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# To build and load custom GO plugins into the Kong Ubuntu image | |
# we use a multistage docker build. The first stage uses the golang | |
# image to build the plugin. The second stage then copies that plugin | |
# into the Kong Ubuntu image. | |
# Build the golang plugin | |
FROM --platform=linux/amd64 golang:alpine as build | |
WORKDIR /plugin | |
COPY go-plugins/* ./ | |
RUN go build go-hello.go | |
# Copy the plugin into the kong-gateway image as root: | |
# ref: https://docs.konghq.com/gateway/latest/plugin-development/pluginserver/plugins-kubernetes/ | |
FROM --platform=linux/amd64 kong/kong-gateway:3.2.2.1-ubuntu | |
USER root | |
COPY --from=build /plugin/go-hello /usr/local/bin/go-hello | |
# Return the image to defaults for runtime | |
USER kong | |
ENTRYPOINT ["/entrypoint.sh"] | |
EXPOSE 8000 8443 8001 8444 | |
STOPSIGNAL SIGQUIT | |
HEALTHCHECK --interval=10s --timeout=10s --retries=10 CMD kong health | |
CMD ["kong", "docker-start"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment