From 3c2172434bd9abf009b916fe43dead41efc74e97 Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Thu, 8 Mar 2018 15:38:17 +0000 Subject: [PATCH] have entrypoint kickoff download off texlive images install script exits without error if auth fails. --- services/clsi/Makefile | 2 +- services/clsi/bin/install_texlive_gce.sh | 13 +++++++++++++ services/clsi/entrypoint.sh | 1 + 3 files changed, 15 insertions(+), 1 deletion(-) create mode 100755 services/clsi/bin/install_texlive_gce.sh diff --git a/services/clsi/Makefile b/services/clsi/Makefile index 74b78a3d42..5c46c268ba 100644 --- a/services/clsi/Makefile +++ b/services/clsi/Makefile @@ -28,11 +28,11 @@ test_acceptance: test_clean # clear the database before each acceptance test run test_clean: $(DOCKER_COMPOSE) down -t 0 + build: docker build --pull --tag quay.io/sharelatex/$(PROJECT_NAME):$(BRANCH_NAME)-$(BUILD_NUMBER) . publish: docker push quay.io/sharelatex/$(PROJECT_NAME):$(BRANCH_NAME)-$(BUILD_NUMBER) - .PHONY: clean test test_unit test_acceptance test_clean build publish diff --git a/services/clsi/bin/install_texlive_gce.sh b/services/clsi/bin/install_texlive_gce.sh new file mode 100755 index 0000000000..20d2ca07f7 --- /dev/null +++ b/services/clsi/bin/install_texlive_gce.sh @@ -0,0 +1,13 @@ +#!/bin/sh +METADATA=http://metadata.google.internal./computeMetadata/v1 +SVC_ACCT=$METADATA/instance/service-accounts/default +ACCESS_TOKEN=$(curl -s -H 'Metadata-Flavor: Google' $SVC_ACCT/token | cut -d'"' -f 4) +if [ -z "$ACCESS_TOKEN" ]; then + echo "No acccess token to download texlive-full images from google container, continuing without downloading. This is likely not a google cloud enviroment." + exit 0 +fi +docker login -u '_token' -p $ACCESS_TOKEN https://gcr.io +docker pull --all-tags gcr.io/henry-terraform-admin/texlive-full #TODO NEED TO MAKE THIS AN ENV VAR +echo "Finished downloading texlive-full images" + + diff --git a/services/clsi/entrypoint.sh b/services/clsi/entrypoint.sh index 588854ed1e..f4861a44a9 100755 --- a/services/clsi/entrypoint.sh +++ b/services/clsi/entrypoint.sh @@ -2,4 +2,5 @@ echo "Changing permissions of /var/run/docker.sock for sibling containers" chown root:docker /var/run/docker.sock +./bin/install_texlive_gce.sh exec runuser -u app "$@" \ No newline at end of file