From 654b3aa58d7ce59c799a89c0fd122ea998f57f0d Mon Sep 17 00:00:00 2001 From: Alexander Fenster Date: Wed, 20 Nov 2019 16:11:29 -0800 Subject: [PATCH] feat: show latest commit when running docker image (#154) --- .gitignore | 1 + docker/Dockerfile | 3 +++ docker/build.sh | 4 ++++ docker/start.sh | 6 ++++++ 4 files changed, 14 insertions(+) diff --git a/.gitignore b/.gitignore index 23f22daf0..a647892fa 100644 --- a/.gitignore +++ b/.gitignore @@ -21,6 +21,7 @@ pbjs-genfiles/ .client_library *test-out* docker/package.tgz +docker/gitlog.txt *.tgz .showcase-typescript .test-application-js diff --git a/docker/Dockerfile b/docker/Dockerfile index f3f1e8179..b97043ca9 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -33,4 +33,7 @@ RUN rm -rf /root/files RUN gapic-generator-typescript --version RUN protoc --version +# Save git log output for debugging purposes +COPY ./gitlog.txt /root/ + ENTRYPOINT [ "/usr/local/bin/start.sh" ] diff --git a/docker/build.sh b/docker/build.sh index c35069cb0..00227fef8 100644 --- a/docker/build.sh +++ b/docker/build.sh @@ -19,6 +19,7 @@ SCRIPTDIR=`dirname "$0"` cd "$SCRIPTDIR" cd .. # now in the package.json directory +git log | head -n 3 > docker/gitlog.txt npm pack VERSION=`cat package.json | grep version | awk -F'"' '{ print $4; }'` @@ -27,3 +28,6 @@ cp "google-cloud-gapic-generator-$VERSION.tgz" "docker/package.tgz" cd docker docker build -t gapic-generator-typescript . + +# Cleanup +rm -f gitlog.txt package.tgz diff --git a/docker/start.sh b/docker/start.sh index 2db4bb9fc..6986b69d1 100644 --- a/docker/start.sh +++ b/docker/start.sh @@ -2,6 +2,12 @@ ### Start script that is an entry point for a Docker image. +# Dump the version of the current code to stderr +echo "gapic-generator-typescript: https://github.com/googleapis/gapic-generator-typescript" 1>&2 +echo "Latest commit: " 1>&2 +cat /root/gitlog.txt 1>&2 +echo 1>&2 + # Change directory to the input directory. # Make it easier to pass gRPC service config relative to it, e.g. # --grpc-service-config google/cloud/texttospeech/v1/texttospeech_grpc_service_config.json