2
0
mirror of https://github.com/frappe/frappe_docker.git synced 2025-01-26 16:48:25 +00:00

add a help file and alphabetize

This commit is contained in:
chabad360 2020-03-03 05:56:14 +00:00
parent ca715e3e5c
commit 37eabd9018

119
travis.sh
View File

@ -1,13 +1,61 @@
#!/bin/bash #!/bin/bash
################# travis.sh ################# ################# ./travis.sh #################
# This script takes care of the common steps # This script takes care of the common steps
# found in the Travis CI builds. # found in the frappe_docker Travis CI builds.
#
# Usage: [-a | -s | -w | -h] [-n <name of service>] [-t <tag> | -g <version number>] [-o]
#
# Argumets:
#
# -a | --assets (exclusive): Build the nginx + static assets image
# -s | --socketio (exclusive): Build the frappe-socketio image
# -w | --worker (exclusive): Build the python environment image
# -h | --help (exclusive): Print this page
#
# -n | --service <name of service>: Name of the service to build: "erpnext" or "frappe"
# Note: --socketio does not respect this argument
# Note: This will build an image with the name "$SERVICE-assets" (i.e. "erpnext-worker", "frappe-assets", etc.)
#
# -t | --tag <tag> (exclusive): The image tag (i.e. erpnext-worker:$TAG )
# -g | --git-version <version number> (exclusive): The version number of --service (i.e. "11", "12", etc.)
# Note: This must be a number, not a string!
#
# -o | --tag-only: Only tag an image and push it.
#
#
while [[ $# -gt 0 ]]; do while [[ $# -gt 0 ]]; do
key="$1" key="$1"
case $key in case $key in
-a|--assets)
ASSETS=1
shift
;;
-g|--git-version)
version="$2"
shift
shift
;;
-h|--help)
HELP=1
shift
;;
-n|--service)
SERVICE="$2"
shift
shift
;;
-o|--tag-only)
TAGONLY=1
shift
;;
-s|--socketio)
SOCKETIO=1
shift
;;
-t|--tag) -t|--tag)
TAG="$2" TAG="$2"
shift shift
@ -17,31 +65,37 @@ while [[ $# -gt 0 ]]; do
WORKER=1 WORKER=1
shift shift
;; ;;
-a|--assets) *)
ASSETS=1 HELP=1
shift
;;
-s|--socketio)
SOCKETIO=1
shift
;;
-n|--name)
NAME="$2"
shift
shift
;;
-o|--tag-only)
TAGONLY=1
shift
;;
-g|--git-branch)
BRANCH="$2"
shift
shift shift
;; ;;
esac esac
done done
function help() {
echo "################ $0 #################"
echo " This script takes care of the common steps found in the frappe_docker Travis CI builds."
echo ""
echo " Usage: [-a | -s | -w | -h] [-n <name of service>] [-t <tag> | -g <version number>] [-o]"
echo ""
echo " Argumets:"
echo ""
echo " -a | --assets (exclusive): Build the nginx + static assets image"
echo " -s | --socketio (exclusive): Build the frappe-socketio image"
echo " -w | --worker (exclusive): Build the python environment image"
echo " -h | --help (exclusive): Print this page"
echo ""
echo " -n | --service <name of service>: Name of the service to build: \"erpnext\" or \"frappe\""
echo " Note: --socketio does not respect this argument"
echo " Note: This will build an image with the name \"\$SERVICE-assets\" (i.e. \"erpnext-worker\", \"frappe-assets\", etc.)"
echo ""
echo " -t | --tag <tag> (exclusive): The image tag (i.e. erpnext-worker:\$TAG)"
echo " -g | --git-version <version number> (exclusive): The version number of --service (i.e. \"11\", \"12\", etc.)"
echo " Note: This must be a number, not a string!"
echo ""
echo " -o | --tag-only: Only tag an image and push it."
}
function gitVersion() { function gitVersion() {
echo "Pulling ${1} v${2}" echo "Pulling ${1} v${2}"
git clone https://github.com/frappe/${1} --branch version-${2} git clone https://github.com/frappe/${1} --branch version-${2}
@ -64,28 +118,33 @@ function build () {
tagAndPush "${1}-${3}" ${2} tagAndPush "${1}-${3}" ${2}
} }
if [[ $BRANCH ]]; then if [[ HELP ]]; then
gitVersion $NAME $BRANCH help
exit 1
fi
if [[ $VERSION ]]; then
gitVersion $SERVICE $VERSION
fi fi
DOCKERFILE=${DOCKERFILE:-Dockerfile} DOCKERFILE=${DOCKERFILE:-Dockerfile}
if [[ $WORKER ]]; then if [[ $WORKER ]]; then
if [[ $TAGONLY ]]; then if [[ $TAGONLY ]]; then
tagAndPush "${NAME}-worker" ${TAG} tagAndPush "${SERVICE}-worker" ${TAG}
else else
build $NAME $TAG worker ${DOCKERFILE} build $SERVICE $TAG worker ${DOCKERFILE}
fi fi
elif [[ $ASSETS ]]; then elif [[ $ASSETS ]]; then
if [[ $TAGONLY ]]; then if [[ $TAGONLY ]]; then
tagAndPush "${NAME}-assets" ${TAG} tagAndPush "${SERVICE}-assets" ${TAG}
else else
build $NAME $TAG assets ${DOCKERFILE} build $SERVICE $TAG assets ${DOCKERFILE}
fi fi
elif [[ $SOCKETIO ]]; then elif [[ $SOCKETIO ]]; then
if [[ $TAGONLY ]]; then if [[ $TAGONLY ]]; then
tagAndPush "${NAME}-socketio" ${TAG} tagAndPush "frappe-socketio" ${TAG}
else else
build $NAME $TAG socketio ${DOCKERFILE} build frappe $TAG socketio ${DOCKERFILE}
fi fi
fi fi