Deploy to git.gar.dev

This commit is contained in:
Georgi Gardev
2026-07-10 20:03:53 +03:00
parent 2295470baa
commit 3ab98b00d3
3 changed files with 39 additions and 0 deletions
+6
View File
@@ -0,0 +1,6 @@
node_modules/
data/
.git/
tests/
Dockerfile
compose.yaml
+1
View File
@@ -1,5 +1,6 @@
services:
sofia-traffic-info:
image: git.gar.dev/georgesg/sofia-traffic-info:${TAG:-latest}
build: .
restart: unless-stopped
volumes:
Executable
+32
View File
@@ -0,0 +1,32 @@
#!/usr/bin/env bash
set -euo pipefail
cd "$(dirname "$0")"
IMAGE="git.gar.dev/georgesg/sofia-traffic-info"
PLATFORMS="linux/amd64,linux/arm64"
# Tag from first arg, else package.json version.
TAG="${1:-$(node -p "require('./package.json').version")}"
echo "🧪 Running tests..."
npm test
echo "🔨 Building ${IMAGE}:${TAG} (${PLATFORMS})..."
docker buildx build \
--platform "${PLATFORMS}" \
-t "${IMAGE}:${TAG}" \
-t "${IMAGE}:latest" \
--push \
.
echo "✅ Pushed ${IMAGE}:${TAG} and ${IMAGE}:latest"
# Optional: restart the app on the server over SSH.
if [[ -n "${DEPLOY_SSH_HOST:-}" ]]; then
DEPLOY_PATH="${DEPLOY_PATH:-sofia-traffic-info}"
echo "🚀 Deploying ${TAG} on ${DEPLOY_SSH_HOST}:${DEPLOY_PATH}..."
ssh "${DEPLOY_SSH_HOST}" "cd '${DEPLOY_PATH}' && TAG='${TAG}' docker compose pull && TAG='${TAG}' docker compose up -d"
echo "✅ Deployed ${IMAGE}:${TAG}"
else
echo "️ To also deploy: DEPLOY_SSH_HOST=user@server [DEPLOY_PATH=path] ./deploy.sh ${TAG}"
fi