Files
caprover/dev-scripts/build_and_push_release.sh
2020-07-01 22:01:06 -04:00

44 lines
764 B
Bash
Executable File

#!/bin/bash
# Exit early if any command fails
set -e
# Print all commands
set -x
pwd
IMAGE_NAME=caprover/caprover
if [ ! -f ./package-lock.json ]; then
echo "package-lock.json not found!"
exit 1;
fi
if ! [ $(id -u) = 0 ]; then
echo "Must run as sudo or root"
exit 1
fi
BRANCH=$(git rev-parse --abbrev-ref HEAD)
echo "on branch $BRANCH"
if [[ "$BRANCH" != "testing-release" ]]; then
echo 'Not on release branch! Aborting script!';
exit 1;
fi
git clean -fdx .
npm ci
npm run build
node ./dev-scripts/validate-build-version-docker-hub.js
source ./version
docker build -t $IMAGE_NAME:$CAPROVER_VERSION -t $IMAGE_NAME:latest -f dockerfile-captain.release .
docker push $IMAGE_NAME:$CAPROVER_VERSION
docker push $IMAGE_NAME:latest