docker-deploy/deploy.sh

30 lines
765 B
Bash
Raw Normal View History

2022-09-18 16:18:35 +02:00
#/usr/bin/env bash
set -e
# Check for the source server (with default)
DEPLOY_SOURCE_FILE="~/.deploy_source"
2022-09-18 16:21:16 +02:00
DEPLOY_SOURCE="https://git.bjphoster.com/deployments"
2022-09-18 16:18:35 +02:00
if [ -f "${DEPLOY_SOURCE_FILE}" ]; then
. "${DEPLOY_SOURCE_FILE}"
fi
# Check for the deploy position (with default)
DEPLOY_DESTINATION_FILE="~/.deploy_destination"
DEPLOY_DESTINATION="/opt"
2022-09-18 17:52:05 +02:00
if [ -f "${DEPLOY_DESTINATION_FILE}" ]; then
. "${DEPLOY_DESTINATION_FILE}"
2022-09-18 16:18:35 +02: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"