Skip to content

Commit

Permalink
feat(go) build and push a go-lang docker image for building go-plugins
Browse files Browse the repository at this point in the history
* split all golang into a separate image

there's no golang in the 'openresty' image.  the final 'kong' image pulls only the
go-pluginserver executable from the golang image.  the tests use the golang image to compile go
plugins, just as the end user would.

* rename image to go-plugin-tool and use DOCKER_GO_SUFFIX key

* release: push new docker image

* chore(release) send the DOCKER_GO_SUFFIX environment variable to the release script

* chore(release) use the latest and dev convenience tags

* chrore(release) don't obscure the alpine tag

Co-authored-by: Colin Hutchinson <chutchic@gmail.com>
  • Loading branch information
javierguerragiraldez and hutchic authored Apr 8, 2020
1 parent aadb6bc commit ea250c3
Show file tree
Hide file tree
Showing 9 changed files with 167 additions and 107 deletions.
28 changes: 27 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ KONG_SHA=$$(git --git-dir=$(KONG_SOURCE_LOCATION)/.git rev-parse --short HEAD)

DOCKER_BASE_SUFFIX=${BUILD_TOOLS_SHA}${CACHE_BUSTER}
DOCKER_OPENRESTY_SUFFIX=${BUILD_TOOLS_SHA}-${REQUIREMENTS_SHA}${OPENRESTY_PATCHES}${DEBUG}-${CACHE_BUSTER}
DOCKER_GO_SUFFIX=${BUILD_TOOLS_SHA}-${KONG_GO_PLUGINSERVER_VERSION}${CACHE_BUSTER}
DOCKER_KONG_SUFFIX=${BUILD_TOOLS_SHA}${OPENRESTY_PATCHES}${DEBUG}-${KONG_VERSION}-${KONG_SHA}-${CACHE_BUSTER}
DOCKER_TEST_SUFFIX=${BUILD_TOOLS_SHA}-${DEBUG}-${KONG_SHA}-${CACHE_BUSTER}

Expand Down Expand Up @@ -152,6 +153,23 @@ endif
-t $(DOCKER_REPOSITORY):$(RESTY_IMAGE_BASE)-$(RESTY_IMAGE_TAG)-$(DOCKER_BASE_SUFFIX) . )
-$(UPDATE_CACHE_COMMAND) $(DOCKER_REPOSITORY):$(RESTY_IMAGE_BASE)-$(RESTY_IMAGE_TAG)-$(DOCKER_BASE_SUFFIX)

build-golang:
ifeq ($(RESTY_IMAGE_BASE),src)
@echo "nothing to be done"
else
$(CACHE_COMMAND) $(DOCKER_REPOSITORY):go-plugin-tool-$(RESTY_IMAGE_BASE)-$(RESTY_IMAGE_TAG)-$(DOCKER_GO_SUFFIX) || \
( $(MAKE) build-base ; \
$(DOCKER_COMMAND) -f dockerfiles/Dockerfile.golang \
--build-arg KONG_GO_PLUGINSERVER_VERSION=$(KONG_GO_PLUGINSERVER_VERSION) \
--build-arg RESTY_IMAGE_TAG="$(RESTY_IMAGE_TAG)" \
--build-arg RESTY_IMAGE_BASE=$(RESTY_IMAGE_BASE) \
--build-arg DOCKER_REPOSITORY=$(DOCKER_REPOSITORY) \
--build-arg DOCKER_BASE_SUFFIX=$(DOCKER_BASE_SUFFIX) \
--build-arg DEBUG=$(DEBUG) \
-t $(DOCKER_REPOSITORY):go-plugin-tool-$(RESTY_IMAGE_BASE)-$(RESTY_IMAGE_TAG)-$(DOCKER_GO_SUFFIX) . )
-$(UPDATE_CACHE_COMMAND) $(DOCKER_REPOSITORY):go-plugin-tool-$(RESTY_IMAGE_BASE)-$(RESTY_IMAGE_TAG)-$(DOCKER_GO_SUFFIX)
endif

build-openresty:
ifeq ($(RESTY_IMAGE_BASE),src)
@echo "nothing to be done"
Expand Down Expand Up @@ -235,11 +253,13 @@ actual-build-kong:
-cp -R $(KONG_SOURCE_LOCATION) kong
$(CACHE_COMMAND) $(DOCKER_REPOSITORY):kong-$(RESTY_IMAGE_BASE)-$(RESTY_IMAGE_TAG)-$(DOCKER_KONG_SUFFIX) || \
( $(MAKE) build-openresty && \
$(MAKE) build-golang && \
$(DOCKER_COMMAND) -f dockerfiles/Dockerfile.kong \
--build-arg RESTY_IMAGE_TAG="$(RESTY_IMAGE_TAG)" \
--build-arg RESTY_IMAGE_BASE=$(RESTY_IMAGE_BASE) \
--build-arg DOCKER_REPOSITORY=$(DOCKER_REPOSITORY) \
--build-arg DOCKER_OPENRESTY_SUFFIX=$(DOCKER_OPENRESTY_SUFFIX) \
--build-arg DOCKER_GO_SUFFIX=$(DOCKER_GO_SUFFIX) \
-t $(DOCKER_REPOSITORY):kong-$(RESTY_IMAGE_BASE)-$(RESTY_IMAGE_TAG)-$(DOCKER_KONG_SUFFIX) . )
-$(UPDATE_CACHE_COMMAND) $(DOCKER_REPOSITORY):kong-$(RESTY_IMAGE_BASE)-$(RESTY_IMAGE_TAG)-$(DOCKER_KONG_SUFFIX)

Expand All @@ -253,6 +273,8 @@ ifneq ($(RESTY_IMAGE_BASE),src)
docker tag $(DOCKER_REPOSITORY):openresty-$(RESTY_IMAGE_BASE)-$(RESTY_IMAGE_TAG)-$(DOCKER_OPENRESTY_SUFFIX) \
$(DOCKER_REPOSITORY):test-$(DOCKER_OPENRESTY_SUFFIX) )

$(MAKE) build-golang

docker run -d --rm --name test $(DOCKER_REPOSITORY):test-$(DOCKER_OPENRESTY_SUFFIX) tail -f /dev/null
docker export test | docker import - $(DOCKER_REPOSITORY):test-$(DOCKER_OPENRESTY_SUFFIX)
docker stop test
Expand All @@ -261,6 +283,7 @@ ifneq ($(RESTY_IMAGE_BASE),src)
--build-arg KONG_GO_PLUGINSERVER_VERSION=$(KONG_GO_PLUGINSERVER_VERSION) \
--build-arg DOCKER_REPOSITORY=$(DOCKER_REPOSITORY) \
--build-arg DOCKER_OPENRESTY_SUFFIX=$(DOCKER_OPENRESTY_SUFFIX) \
--build-arg DOCKER_GO_SUFFIX=$(DOCKER_GO_SUFFIX) \
-t $(DOCKER_REPOSITORY):test-$(DOCKER_TEST_SUFFIX) .
docker tag $(DOCKER_REPOSITORY):test-$(DOCKER_TEST_SUFFIX) $(DOCKER_REPOSITORY):test
docker tag $(DOCKER_REPOSITORY):test-$(DOCKER_TEST_SUFFIX) $(DOCKER_REPOSITORY):test-$(DOCKER_OPENRESTY_SUFFIX)
Expand All @@ -277,6 +300,7 @@ release-kong: test
ARCHITECTURE=amd64 \
RESTY_IMAGE_BASE=$(RESTY_IMAGE_BASE) \
RESTY_IMAGE_TAG=$(RESTY_IMAGE_TAG) \
DOCKER_GO_SUFFIX=$(DOCKER_GO_SUFFIX) \
KONG_PACKAGE_NAME=$(KONG_PACKAGE_NAME) \
KONG_VERSION=$(KONG_VERSION) \
BINTRAY_USR=$(BINTRAY_USR) \
Expand All @@ -287,11 +311,13 @@ ifeq ($(BUILDX),true)
@ARCHITECTURE=arm64 \
RESTY_IMAGE_BASE=$(RESTY_IMAGE_BASE) \
RESTY_IMAGE_TAG=$(RESTY_IMAGE_TAG) \
DOCKER_GO_SUFFIX=$(DOCKER_GO_SUFFIX) \
KONG_PACKAGE_NAME=$(KONG_PACKAGE_NAME) \
KONG_VERSION=$(KONG_VERSION) \
BINTRAY_USR=$(BINTRAY_USR) \
BINTRAY_KEY=$(BINTRAY_KEY) \
PRIVATE_REPOSITORY=$(PRIVATE_REPOSITORY) \
DOCKER_GO_SUFFIX=$(DOCKER_GO_SUFFIX) \
./release-kong.sh
endif

Expand Down Expand Up @@ -320,7 +346,7 @@ ifneq ($(RESTY_IMAGE_BASE),src)
KONG_ADMIN_URI="http://$(TEST_HOST):$(TEST_ADMIN_PORT)" \
KONG_PROXY_URI="http://$(TEST_HOST):$(TEST_PROXY_PORT)" \
TEST_COMPOSE_PATH=$(TEST_COMPOSE_PATH) \
DOCKER_GO_BUILDER=$(DOCKER_REPOSITORY):openresty-$(RESTY_IMAGE_BASE)-$(RESTY_IMAGE_TAG)-$(DOCKER_OPENRESTY_SUFFIX) \
DOCKER_GO_BUILDER=$(DOCKER_REPOSITORY):go-plugin-tool-$(RESTY_IMAGE_BASE)-$(RESTY_IMAGE_TAG)-$(DOCKER_GO_SUFFIX) \
./test/run_tests.sh
endif

Expand Down
54 changes: 54 additions & 0 deletions dockerfiles/Dockerfile.golang
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
ARG RESTY_IMAGE_BASE="ubuntu"
ARG RESTY_IMAGE_TAG="bionic"
ARG DOCKER_BASE_SUFFIX
ARG DOCKER_REPOSITORY

FROM ${DOCKER_REPOSITORY}:${RESTY_IMAGE_BASE}-${RESTY_IMAGE_TAG}-${DOCKER_BASE_SUFFIX}

ENV GOLANG_VERSION 1.13.5
ARG KONG_GO_PLUGINSERVER_VERSION=master
ENV KONG_GO_PLUGINSERVER_VERSION $KONG_GO_PLUGINSERVER_VERSION


RUN set -eux; \
dpkgArch="$(dpkg --print-architecture || echo amd64)"; \
case "${dpkgArch##*-}" in \
amd64) goRelArch='linux-amd64'; goRelSha256='512103d7ad296467814a6e3f635631bd35574cab3369a97a323c9a585ccaa569' ;; \
armhf) goRelArch='linux-armv6l'; goRelSha256='26259f61d52ee2297b1e8feef3a0fc82144b666a2b95512402c31cc49713c133' ;; \
arm64) goRelArch='linux-arm64'; goRelSha256='227b718923e20c846460bbecddde9cb86bad73acc5fb6f8e1a96b81b5c84668b' ;; \
*) goRelArch='src'; goRelSha256='27d356e2a0b30d9983b60a788cf225da5f914066b37a6b4f69d457ba55a626ff'; \
echo >&2; echo >&2 "warning: current architecture ($dpkgArch) does not have a corresponding Go binary release; will be building from source"; echo >&2 ;; \
esac; \
\
url="https://golang.org/dl/go${GOLANG_VERSION}.${goRelArch}.tar.gz"; \
curl -fsSLo go.tgz "$url"; \
echo "${goRelSha256} *go.tgz" | sha256sum -c -; \
tar -C /usr/local -xzf go.tgz; \
rm go.tgz; \
\
if [ "$goRelArch" = 'src' ]; then \
echo >&2; \
echo >&2 'error: UNIMPLEMENTED'; \
echo >&2 'TODO install golang-any from jessie-backports for GOROOT_BOOTSTRAP (and uninstall after build)'; \
echo >&2; \
exit 1; \
fi; \
\
export PATH="/usr/local/go/bin:$PATH" ; \
export GOPATH="/tmp/go" ; \
\
mkdir /gps ; cd /gps ; \
go mod init go-pluginserver ; \
go get -d -v github.com/Kong/go-pluginserver@${KONG_GO_PLUGINSERVER_VERSION} ; \
go install ... ; \
cp /tmp/go/bin/go-pluginserver /usr/local/bin/ ;\
cd ; rm -r /gps

RUN (echo '#!/bin/sh' && echo 'go build -buildmode=plugin "$@"') >> /usr/local/bin/build && \
chmod a+x /usr/local/bin/build

ENV GOPATH=/tmp/go
ENV PATH /usr/local/go/bin:$PATH

VOLUME /plugins
WORKDIR /plugins
5 changes: 5 additions & 0 deletions dockerfiles/Dockerfile.kong
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
ARG RESTY_IMAGE_BASE="ubuntu"
ARG RESTY_IMAGE_TAG="bionic"
ARG DOCKER_OPENRESTY_SUFFIX
ARG DOCKER_GO_SUFFIX
ARG DOCKER_REPOSITORY

FROM ${DOCKER_REPOSITORY}:go-plugin-tool-${RESTY_IMAGE_BASE}-${RESTY_IMAGE_TAG}-${DOCKER_GO_SUFFIX} as GOLANG

FROM ${DOCKER_REPOSITORY}:openresty-${RESTY_IMAGE_BASE}-${RESTY_IMAGE_TAG}-${DOCKER_OPENRESTY_SUFFIX}

WORKDIR /kong
Expand All @@ -12,3 +15,5 @@ COPY build-kong.sh /build-kong.sh

RUN /build-kong.sh
COPY kong.logrotate /tmp/build/etc/kong/kong.logrotate

COPY --from=GOLANG /usr/local/bin/go-pluginserver /tmp/build/usr/local/bin/go-pluginserver
48 changes: 0 additions & 48 deletions dockerfiles/Dockerfile.openresty
Original file line number Diff line number Diff line change
Expand Up @@ -65,54 +65,6 @@ RUN if [ "$EDITION" = "enterprise" ] ; then curl -fsSLo /tmp/passwdqc-${KONG_DEP
MANDIR=/usr/local/share/man \
install_lib; fi

ENV GOLANG_VERSION 1.13.5

RUN set -eux; \
dpkgArch="$(dpkg --print-architecture || echo amd64)"; \
case "${dpkgArch##*-}" in \
amd64) goRelArch='linux-amd64'; goRelSha256='512103d7ad296467814a6e3f635631bd35574cab3369a97a323c9a585ccaa569' ;; \
armhf) goRelArch='linux-armv6l'; goRelSha256='26259f61d52ee2297b1e8feef3a0fc82144b666a2b95512402c31cc49713c133' ;; \
arm64) goRelArch='linux-arm64'; goRelSha256='227b718923e20c846460bbecddde9cb86bad73acc5fb6f8e1a96b81b5c84668b' ;; \
*) goRelArch='src'; goRelSha256='27d356e2a0b30d9983b60a788cf225da5f914066b37a6b4f69d457ba55a626ff'; \
echo >&2; echo >&2 "warning: current architecture ($dpkgArch) does not have a corresponding Go binary release; will be building from source"; echo >&2 ;; \
esac; \
\
url="https://golang.org/dl/go${GOLANG_VERSION}.${goRelArch}.tar.gz"; \
curl -fsSLo go.tgz "$url"; \
echo "${goRelSha256} *go.tgz" | sha256sum -c -; \
tar -C /usr/local -xzf go.tgz; \
rm go.tgz; \
\
if [ "$goRelArch" = 'src' ]; then \
echo >&2; \
echo >&2 'error: UNIMPLEMENTED'; \
echo >&2 'TODO install golang-any from jessie-backports for GOROOT_BOOTSTRAP (and uninstall after build)'; \
echo >&2; \
exit 1; \
fi; \
\
export PATH="/usr/local/go/bin:$PATH"


ARG KONG_GO_PLUGINSERVER_VERSION=master
ENV KONG_GO_PLUGINSERVER_VERSION $KONG_GO_PLUGINSERVER_VERSION

ENV GOPATH=/tmp/go
ENV PATH $GOPATH/bin:/usr/local/go/bin:$PATH

RUN go version
RUN mkdir -p /tmp/go/src/github.com/kong/ \
&& git clone --branch ${KONG_GO_PLUGINSERVER_VERSION} https://github.com/Kong/go-pluginserver.git /tmp/go/src/github.com/kong/go-pluginserver \
&& cd /tmp/go/src/github.com/kong/go-pluginserver \
&& go mod tidy

RUN set -eux; \
dpkgArch="$(dpkg --print-architecture || echo amd64)" \
&& cd /tmp/go/src/github.com/kong/go-pluginserver \
&& make build GOARCH=$dpkgArch GOOS=linux \
&& mkdir -p /tmp/build/usr/local/bin/ \
&& mv go-pluginserver /tmp/build/usr/local/bin/

ARG RESTY_VERSION=1.13.6.2
LABEL resty_version="${RESTY_VERSION}"

Expand Down
8 changes: 7 additions & 1 deletion release-kong.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ if [ "$REPOSITORY_OS_NAME" == "next" ]; then
fi

if [ "$RESTY_IMAGE_BASE" != "src" ]; then
docker tag mashape/kong-build-tools:go-plugin-tool-${RESTY_IMAGE_BASE}-${RESTY_IMAGE_TAG}-${DOCKER_GO_SUFFIX} kong/go-plugin-tool:${KONG_VERSION}-${RESTY_IMAGE_BASE}-${RESTY_IMAGE_TAG}
docker push kong/go-plugin-tool:${KONG_VERSION}-${RESTY_IMAGE_BASE}-${RESTY_IMAGE_TAG}
docker tag mashape/kong-build-tools:go-plugin-tool-${RESTY_IMAGE_BASE}-${RESTY_IMAGE_TAG}-${DOCKER_GO_SUFFIX} kong/go-plugin-tool:${DOCKER_TAG}-${RESTY_IMAGE_BASE}-${RESTY_IMAGE_TAG}
docker push kong/go-plugin-tool:${DOCKER_TAG}-${RESTY_IMAGE_BASE}-${RESTY_IMAGE_TAG}

docker tag localhost:5000/kong-${RESTY_IMAGE_BASE}-${RESTY_IMAGE_TAG} ${DOCKER_REPOSITORY}:${KONG_VERSION}-${RESTY_IMAGE_BASE}-${RESTY_IMAGE_TAG}
docker push ${DOCKER_REPOSITORY}:${KONG_VERSION}-${RESTY_IMAGE_BASE}-${RESTY_IMAGE_TAG}
docker tag localhost:5000/kong-${RESTY_IMAGE_BASE}-${RESTY_IMAGE_TAG} ${DOCKER_REPOSITORY}:${DOCKER_TAG}-${RESTY_IMAGE_BASE}-${RESTY_IMAGE_TAG}
Expand Down Expand Up @@ -56,6 +61,7 @@ elif [ "$RESTY_IMAGE_BASE" == "alpine" ]; then

docker tag localhost:5000/kong-${RESTY_IMAGE_BASE}-${RESTY_IMAGE_TAG} ${DOCKER_REPOSITORY}:${DOCKER_TAG}
docker push ${DOCKER_REPOSITORY}:${DOCKER_TAG}

elif [ "$RESTY_IMAGE_BASE" == "amazonlinux" ]; then
BINTRAY_DIRECTORY="amazonlinux/amazonlinux"
REPOSITORY_TYPE="${REPOSITORY_TYPE:-rpm}"
Expand Down Expand Up @@ -209,4 +215,4 @@ print_result "$REPOSITORY_NAME artifact upload" "$RESPONSE"

echo -e "\nVersion $KONG_VERSION release finished"

exit 0
exit 0
98 changes: 51 additions & 47 deletions test/Dockerfile.test
Original file line number Diff line number Diff line change
@@ -1,47 +1,51 @@
ARG DOCKER_OPENRESTY_SUFFIX
ARG DOCKER_REPOSITORY

FROM ${DOCKER_REPOSITORY}:test-${DOCKER_OPENRESTY_SUFFIX}

ENV PATH=$PATH:/kong/bin:/usr/local/openresty/bin/:/usr/local/kong/bin/:/usr/local/openresty/nginx/sbin/
ENV LUA_PATH=/kong/?.lua;/kong/?/init.lua;/root/.luarocks/share/lua/5.1/?.lua;/root/.luarocks/share/lua/5.1/?/init.lua;/usr/local/share/lua/5.1/?.lua;/usr/local/share/lua/5.1/?/init.lua;./?.lua;/usr/local/openresty/luajit/share/luajit-2.1.0-beta3/?.lua;/usr/local/openresty/luajit/share/lua/5.1/?.lua;/usr/local/openresty/luajit/share/lua/5.1/?/init.lua
ENV LUA_CPATH=/root/.luarocks/lib/lua/5.1/?.so;/usr/local/lib/lua/5.1/?.so;./?.so;/usr/local/openresty/luajit/lib/lua/5.1/?.so;/usr/local/lib/lua/5.1/loadall.so

RUN cp -R /tmp/build/* / || true
RUN rm -rf /usr/local/bin/kong
RUN ln -fs /usr/share/zoneinfo/America/New_York /etc/localtime && \
apt-get update && apt-get install -y \
tzdata \
vim \
jq \
httpie \
iputils-ping \
net-tools \
valgrind \
net-tools && \
dpkg-reconfigure --frontend noninteractive tzdata && \
apt-get install -y postgresql

ENV KONG_GO_PLUGINSERVER_VERSION=master
ENV GOPATH=/tmp/go
ENV PATH $GOPATH/bin:/usr/local/go/bin:$PATH

RUN rm -rf /tmp/go/src/github.com/kong/ \
&& mkdir -p /tmp/go/src/github.com/kong/ \
&& git clone --branch ${KONG_GO_PLUGINSERVER_VERSION} https://github.com/Kong/go-pluginserver.git /tmp/go/src/github.com/kong/go-pluginserver \
&& cd /tmp/go/src/github.com/kong/go-pluginserver \
&& go mod tidy

COPY kong /kong
RUN mkdir -p /kong/servroot/logs
RUN chmod -R 777 /kong
WORKDIR /kong
RUN make dev

RUN curl -L https://cpanmin.us | perl - App::cpanminus \
&& cpanm --notest Test::Nginx \
&& cpanm --notest local::lib

RUN rm -rf /tmp/build

CMD ["sh", "-c", "cat /kong/spec/fixtures/hosts >> /etc/hosts; tail -f /dev/null"]
ARG RESTY_IMAGE_BASE="ubuntu"
ARG RESTY_IMAGE_TAG="bionic"
ARG DOCKER_KONG_SUFFIX
ARG DOCKER_OPENRESTY_SUFFIX
ARG DOCKER_GO_SUFFIX
ARG DOCKER_REPOSITORY

FROM ${DOCKER_REPOSITORY}:go-plugin-tool-${RESTY_IMAGE_BASE}-${RESTY_IMAGE_TAG}-${DOCKER_GO_SUFFIX} as GOLANG

FROM ${DOCKER_REPOSITORY}:test-${DOCKER_OPENRESTY_SUFFIX}

ENV PATH=$PATH:/kong/bin:/usr/local/openresty/bin/:/usr/local/kong/bin/:/usr/local/openresty/nginx/sbin/
ENV LUA_PATH=/kong/?.lua;/kong/?/init.lua;/root/.luarocks/share/lua/5.1/?.lua;/root/.luarocks/share/lua/5.1/?/init.lua;/usr/local/share/lua/5.1/?.lua;/usr/local/share/lua/5.1/?/init.lua;./?.lua;/usr/local/openresty/luajit/share/luajit-2.1.0-beta3/?.lua;/usr/local/openresty/luajit/share/lua/5.1/?.lua;/usr/local/openresty/luajit/share/lua/5.1/?/init.lua
ENV LUA_CPATH=/root/.luarocks/lib/lua/5.1/?.so;/usr/local/lib/lua/5.1/?.so;./?.so;/usr/local/openresty/luajit/lib/lua/5.1/?.so;/usr/local/lib/lua/5.1/loadall.so

RUN cp -R /tmp/build/* / || true
RUN rm -rf /usr/local/bin/kong
RUN ln -fs /usr/share/zoneinfo/America/New_York /etc/localtime && \
apt-get update && apt-get install -y \
tzdata \
vim \
jq \
httpie \
iputils-ping \
net-tools \
valgrind \
net-tools && \
dpkg-reconfigure --frontend noninteractive tzdata && \
apt-get install -y postgresql

COPY --from=GOLANG /usr/local/go /usr/local/go

ENV KONG_GO_PLUGINSERVER_VERSION=master
ENV GOPATH=/tmp/go
ENV PATH $GOPATH/bin:/usr/local/go/bin:$PATH

COPY kong /kong
RUN mkdir -p /kong/servroot/logs
RUN chmod -R 777 /kong
WORKDIR /kong
RUN make dev

RUN curl -L https://cpanmin.us | perl - App::cpanminus \
&& cpanm --notest Test::Nginx \
&& cpanm --notest local::lib

RUN rm -rf /tmp/build

COPY --from=GOLANG /usr/local/bin/go-pluginserver /usr/local/bin/go-pluginserver

CMD ["sh", "-c", "cat /kong/spec/fixtures/hosts >> /etc/hosts; tail -f /dev/null"]
2 changes: 1 addition & 1 deletion test/tests/01-package/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ docker run ${USE_TTY} --user=root --rm ${KONG_TEST_IMAGE_NAME} /bin/sh -c "luaro

# kong binaries
docker run ${USE_TTY} --user=root --rm ${KONG_TEST_IMAGE_NAME} /bin/sh -c "/usr/local/kong/bin/openssl version | grep -q ${RESTY_OPENSSL_VERSION}"
docker run ${USE_TTY} --user=root --rm ${KONG_TEST_IMAGE_NAME} /bin/sh -c "ls -la /usr/local/bin/go-pluginserver"
docker run ${USE_TTY} --user=root --rm ${DOCKER_GO_BUILDER} /bin/sh -c "ls -la /usr/local/bin/go-pluginserver"

# TODO enable this test in other distros containing systemd
if [[ "$RESTY_IMAGE_TAG" == "bionic" ]]; then
Expand Down
2 changes: 1 addition & 1 deletion test/tests/03-go-plugins/Dockerfile.custom_kong
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ FROM ${KONG_TEST_IMAGE_NAME}

USER root

COPY go-hello.so /usr/local/kong
COPY go-plugins/*.so /usr/local/kong/

RUN chown -R kong:0 /usr/local/kong

Expand Down
Loading

0 comments on commit ea250c3

Please sign in to comment.