43 lines
828 B
Bash
Executable File
43 lines
828 B
Bash
Executable File
#!/bin/bash
|
|
|
|
GIT_COMMIT=$(git rev-parse HEAD)
|
|
|
|
if [[ $GIT_COMMIT == "" ]]; then
|
|
echo "--Missing required GIT_COMMIT var. Aborting..."
|
|
exit 1
|
|
fi
|
|
|
|
#Setup useful vars
|
|
team="engvis"
|
|
app="alert-on-metrics-app"
|
|
|
|
registryV2="registry-app.eng.qops.net:5001"
|
|
pathV2="${registryV2}/${team}/${app}"
|
|
commitV2="${pathV2}:${GIT_COMMIT}"
|
|
latestV2="${pathV2}:latest"
|
|
|
|
# In case you use relative paths
|
|
DIR=$(cd $(dirname $BASH_SOURCE[0]) && pwd)
|
|
cd $DIR
|
|
|
|
echo "--Publishing $app $GIT_COMMIT"
|
|
|
|
echo "--Removing old image, so they don't accumulate"
|
|
docker rmi $latestV2
|
|
|
|
#Now fail if anything doesn't work
|
|
set -e
|
|
|
|
if [ -f $app/build.sh ]
|
|
then
|
|
echo "--Running pre build steps"
|
|
$app/build.sh
|
|
fi
|
|
|
|
docker build --pull=true --tag="$commitV2" --tag "$latestV2" .
|
|
|
|
echo "--Publishing app container"
|
|
|
|
docker push $commitV2
|
|
docker push $latestV2
|