1
0
mirror of https://github.com/raseels-repos/golang-saas-starter-kit.git synced 2025-08-08 22:36:41 +02:00

updated gitlab to cache devops tool build

This commit is contained in:
Lee Brown
2019-08-06 13:38:51 -08:00
parent a327dc0197
commit 34886325f6
3 changed files with 51 additions and 1 deletions

26
tools/devops/scripts/build.sh Executable file
View File

@ -0,0 +1,26 @@
#!/usr/bin/env bash
doPush=0
if [[ "${CI_REGISTRY_USER}" != "" ]]; then
docker login -u ${CI_REGISTRY_USER} -p ${CI_REGISTRY_PASSWORD}
releaseImg="${CI_REGISTRY_IMAGE}:devops-${CI_COMMIT_REF_NAME}"
doPush=1
else :
releaseImg="devops"
fi
echo "release image: ${releaseImg}"
docker pull ${releaseImg} || true
docker build -f tools/devops/Dockerfile --cache-from ${releaseImg} -t ${releaseImg} .
if [[ $doPush == 1 ]]; then
docker push ${releaseImg}
fi
binPath=$GOROOT/bin/devops
echo "installing to: ${binPath}"
docker run --rm --entrypoint=cat devops /devops > $binPath