Skip to content

Instantly share code, notes, and snippets.

@ndelitski
Last active November 3, 2015 23:38
Show Gist options
  • Select an option

  • Save ndelitski/e5f6710bdcfa9026c69a to your computer and use it in GitHub Desktop.

Select an option

Save ndelitski/e5f6710bdcfa9026c69a to your computer and use it in GitHub Desktop.
ci scripts
#!/bin/bash
set -e
repo=${DOCKER_REGISTRY}
[ -z "${DOCKER_REGISTRY}" ] && (echo "DOCKER_REGISTRY is missing"; exit 1)
image=$(node -p "$(cat <<EOF
require('./package.json').name.replace('synccloud.','');
EOF
)")
version=$(node -p "$(cat <<EOF
require('./package.json').version;
EOF
)")
container=$(echo $image | tr '.' '-')
build() {
docker build --pull --rm -t ${image} ./
}
push() {
local version=${1:-$version}
docker tag -f ${image} ${repo}/${image}:${version}
docker push ${repo}/${image}:${version}
}
build
push $@
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment