receipt_indexer/setup.sh
Ethan Wellenreiter a4d75fc6bd Updating scripts to work with this branch
Just making textextractor one of the branches that can be chosen
in the scripts.

Signed-off-by: Ethan Wellenreiter <ewellenreiter@gmail.com>
2023-10-18 23:30:35 -04:00

52 lines
1.1 KiB
Bash
Executable File

#!/bin/bash
# Info
usage() {
echo "${0} devbranch [devbranch]" 1>&2
echo "for example: ${0} autocropper" 1>&2
exit 1
}
# Do we have exactly 1 command-line arguments or not?
if [ ! ${#} -ge 1 ]; then
usage
fi
# actual script
realbranches=("app" "autocropper textextractor")
branches=()
for arg in $(seq 1 ${#}); do
if [[ $(echo ${realbranches[@]} | fgrep -w ${!arg}) ]]; then
branches+=( ${!arg} )
else
echo "${!arg} is not a branch name. The possible branches are: ${realbranches[@]}" 1>&2
exit 1
fi
done
for branch in ${branches[@]}; do
cd ./docker
dockerfilename="./"${branch}"dockerfile"
imagename=${branch}"indexerenv"
# echo "${imagename}"
# echo "$(pwd)"
# echo "${dockerfilename}"
echo "----------STARTING ${branch} DOCKER BUILD----------"
docker build --file ${dockerfilename} --tag ${imagename} .
cd ..
echo -e "----------${branch} DOCKER BUILD FINISHED----------\n\n\n"
done
# echo "Run docker on image \"indexerenv\""
echo "-----WARNING: RUN X SERVER IF ON MAC OR WINDOWS (OR A REQUIRED LINUX DISTRO (NOT UBUNTU)) PRIOR TO RUNNING DOCKER CONTAINER-----"
exit 0