docker-deploy/deploy.sh

30 lines
777 B
Bash
Raw Normal View History

2022-09-18 14:18:35 +00:00
#/usr/bin/env bash
set -e
# Check for the source server (with default)
DEPLOY_SOURCE_FILE="${HOME}/.deploy_source"
2022-09-18 14:21:16 +00:00
DEPLOY_SOURCE="https://git.bjphoster.com/deployments"
2022-09-18 14:18:35 +00:00
if [ -f "${DEPLOY_SOURCE_FILE}" ]; then
. "${DEPLOY_SOURCE_FILE}"
fi
# Check for the deploy position (with default)
DEPLOY_DESTINATION_FILE="${HOME}/.deploy_destination"
2022-09-18 14:18:35 +00:00
DEPLOY_DESTINATION="/opt"
2022-09-18 15:52:05 +00:00
if [ -f "${DEPLOY_DESTINATION_FILE}" ]; then
. "${DEPLOY_DESTINATION_FILE}"
2022-09-18 14:18:35 +00:00
fi
# Check if the correct usage is respected
if [ $# -ne 2 ]; then
echo "Usage: $0 <service> <service name>"
echo
echo "Current settings:"
echo "- Source · ${DEPLOY_SOURCE}"
echo "- Destination · ${DEPLOY_DESTINATION}"
exit
fi
echo "deploying ..."
git clone "${DEPLOY_SOURCE}/${1}" "${DEPLOY_DESTINATION}/$2"