From b813d64da66559c817122948350c0a76ccb61073 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Knut=20Olav=20L=C3=B8ite?= Date: Mon, 4 Dec 2023 19:12:51 +0100 Subject: [PATCH] feat: expose REST port for gcloud support --- .github/workflows/docker-build-and-push.yaml | 14 -------------- build/emulator/Dockerfile | 13 +++++++------ build/emulator/startup.sh | 2 +- 3 files changed, 8 insertions(+), 21 deletions(-) diff --git a/.github/workflows/docker-build-and-push.yaml b/.github/workflows/docker-build-and-push.yaml index cd3ca14cf..645a03d54 100644 --- a/.github/workflows/docker-build-and-push.yaml +++ b/.github/workflows/docker-build-and-push.yaml @@ -40,20 +40,6 @@ jobs: export TAG=`echo $GITHUB_REF | awk -F/ '{print $NF}'` echo $TAG docker buildx create --name multi_platform --use - docker buildx build --platform linux/amd64,linux/arm64 \ - . -f build/Dockerfile \ - -t "$GCR_HOSTNAME"/"$IMAGE":"$TAG" \ - -t "$GCR_HOSTNAME"/"$IMAGE":latest \ - --push \ - --build-arg GITHUB_SHA="$GITHUB_SHA" \ - --build-arg GITHUB_REF="$GITHUB_REF" - docker buildx build --platform linux/amd64,linux/arm64 \ - . -f build/distroless/Dockerfile \ - -t "$GCR_HOSTNAME"/"$IMAGE"-distroless:"$TAG" \ - -t "$GCR_HOSTNAME"/"$IMAGE"-distroless:latest \ - --push \ - --build-arg GITHUB_SHA="$GITHUB_SHA" \ - --build-arg GITHUB_REF="$GITHUB_REF" docker buildx build --platform linux/amd64,linux/arm64 \ . -f build/emulator/Dockerfile \ -t "$GCR_HOSTNAME"/"$IMAGE"-emulator:"$TAG" \ diff --git a/build/emulator/Dockerfile b/build/emulator/Dockerfile index 1d7ffa08e..61c84178e 100644 --- a/build/emulator/Dockerfile +++ b/build/emulator/Dockerfile @@ -12,13 +12,14 @@ FROM gcr.io/cloud-spanner-pg-adapter/pgadapter AS pgadapter ADD build/emulator/startup.sh /home/pgadapter/startup.sh RUN chmod +x /home/pgadapter/startup.sh -# Add the emulator binary. -COPY --from=emulator --chown=nonroot /emulator_main /emulator/emulator_main -COPY --from=emulator --chown=nonroot /licenses.txt.gz /emulator/licenses.txt.gz +# Add the emulator binaries. +COPY --from=emulator /gateway_main /emulator/gateway_main +COPY --from=emulator /emulator_main /emulator/emulator_main +COPY --from=emulator /licenses.txt.gz /emulator/licenses.txt.gz +RUN chmod u+x /emulator/gateway_main RUN chmod u+x /emulator/emulator_main -# Expose both 5432 (PGAdapter PostgreSQL port) and 9010 (Emulator gRPC port) -EXPOSE 5432 -EXPOSE 9010 +# Expose 5432 (PGAdapter PostgreSQL port), 9010 (Emulator gRPC port), and 9020 (Emulator REST port) +EXPOSE 5432 9010 9020 ENTRYPOINT ["/bin/bash", "/home/pgadapter/startup.sh"] diff --git a/build/emulator/startup.sh b/build/emulator/startup.sh index 608af3a0f..bc9bc111d 100755 --- a/build/emulator/startup.sh +++ b/build/emulator/startup.sh @@ -12,7 +12,7 @@ do fi done -nohup sh -c "/emulator/emulator_main --host_port localhost:9010 &" +nohup sh -c "/emulator/gateway_main --hostname \"0.0.0.0\" &" cd /home/pgadapter COMMAND="java ${JAVA_ARGUMENTS} -jar pgadapter.jar ${ARGUMENTS}"