11 lines
696 B
Bash
Executable File
11 lines
696 B
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
: "${IMAGE:?Provide immutable registry image tag or digest}"
|
|
DEPLOY_HOST="${DEPLOY_HOST:-zz}"
|
|
REMOTE_RELEASE="/tmp/videoreg-static-deploy"
|
|
ssh -o BatchMode=yes "$DEPLOY_HOST" "mkdir -p '$REMOTE_RELEASE'"
|
|
scp -o BatchMode=yes deploy/stack.yml "$DEPLOY_HOST:$REMOTE_RELEASE/stack.yml"
|
|
# IMAGE is validated to avoid injecting shell commands in the remote environment.
|
|
[[ "$IMAGE" =~ ^[a-zA-Z0-9._/:@-]+$ ]] || exit 2
|
|
ssh -o BatchMode=yes "$DEPLOY_HOST" "cd '$REMOTE_RELEASE' && IMAGE='$IMAGE' DOMAIN=videoreg.ru STACK_NAME=videoreg TRAEFIK_NETWORK=traefik-public docker stack deploy --with-registry-auth -c stack.yml videoreg && docker stack services videoreg"
|