Skip to content

Instantly share code, notes, and snippets.

@shanestillwell
Created July 27, 2016 19:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shanestillwell/bbe3ef0761258731f8fd48a383a104f6 to your computer and use it in GitHub Desktop.
Save shanestillwell/bbe3ef0761258731f8fd48a383a104f6 to your computer and use it in GitHub Desktop.
Publish my git/docker code
#!/bin/bash
IMAGE_NAME=registry.gitlab.com/shanestillwell/goscouter-api;
CURR_COMMIT=$(git rev-parse HEAD);
CURR_VERSION=$(node -e "console.log(require('./package.json').version);");
VER_HASH=$(git rev-list -n 1 v$CURR_VERSION);
# Don't want to redo version bump
if [ $CURR_COMMIT == $VER_HASH ]
then
echo 'Already up to date'
exit
fi
npm version patch;
NEW_VERSION=$(node -e "console.log(require('./package.json').version);");
echo $NEW_VERSION;
docker build -f Dockerfile.prod -t $IMAGE_NAME .;
BUILD_ID=$(docker images -q $IMAGE_NAME:latest);
docker tag $BUILD_ID $IMAGE_NAME:$NEW_VERSION
docker push registry.gitlab.com/shanestillwell/goscouter-api:$NEW_VERSION
git push origin head;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment