From e23be1935b934fa25abca31741caed072da4f041 Mon Sep 17 00:00:00 2001 From: Alexander Sergeevich <7339834@gmail.com> Date: Sat, 7 Feb 2026 23:24:04 +0300 Subject: [PATCH] Add deploy.sh --- deploy/my-vpn/deploy.sh | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 deploy/my-vpn/deploy.sh diff --git a/deploy/my-vpn/deploy.sh b/deploy/my-vpn/deploy.sh new file mode 100644 index 0000000..27cb1a4 --- /dev/null +++ b/deploy/my-vpn/deploy.sh @@ -0,0 +1,38 @@ +#!/usr/bin/env bash +set -euo pipefail + +# BLOCK 1: config + sanity checks +APP_DIR="/srv/proxyfier" +REPO_URL="ssh://git@git.ornot.ru:2223/alexanderOrNot/proxyfier.git" +BRANCH="main" +IMAGE="proxyfier:latest" +CONTAINER="proxyfier" +PORT="9000" + +command -v git >/dev/null 2>&1 || { echo "git not found"; exit 1; } +command -v docker >/dev/null 2>&1 || { echo "docker not found"; exit 1; } + +# BLOCK 2: get/update source code +if [[ ! -d "$APP_DIR/.git" ]]; then + mkdir -p "$APP_DIR" + git clone "$REPO_URL" "$APP_DIR" +fi +cd "$APP_DIR" +git fetch --all +git reset --hard "origin/${BRANCH}" + +# BLOCK 3: build image +docker build -t "$IMAGE" . + +# BLOCK 4: run container +if docker ps -a --format '{{.Names}}' | grep -q "^${CONTAINER}$"; then + docker rm -f "$CONTAINER" +fi +docker run -d --name "$CONTAINER" \ + --restart unless-stopped \ + -p "${PORT}:${PORT}" \ + -v "$APP_DIR/config.yaml:/app/config.yaml:ro" \ + -e PROXYFIER_CONFIG=/app/config.yaml \ + "$IMAGE" + +echo "OK: deployed ${CONTAINER} on port ${PORT}"