Add production deployment: Dockerfile, docker-compose, deploy script

- Dockerfile: multi-stage build (golang:1.25-alpine → alpine:3.21), linux/amd64
- infra/mariadb: docker-compose + init SQL for reanimator DB/user
- infra/reanimator: docker-compose for reanimator-api (Gitea registry)
- deploy.sh: local build → push to git.mchus.pro → SSH deploy

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Mikhail Chusavitin
2026-03-02 14:00:54 +03:00
parent 4c284505a8
commit 0e72a1d284
7 changed files with 134 additions and 0 deletions

55
deploy.sh Executable file
View File

@@ -0,0 +1,55 @@
#!/usr/bin/env bash
set -euo pipefail
IMAGE="git.mchus.pro/reanimator/core"
TAG="${1:-latest}"
DEPLOY_DIR="/appdata/reanimator"
echo "Deploy target:"
echo " 1) local"
echo " 2) remote (SSH)"
read -rp "Choice [1/2]: " choice
case "$choice" in
1)
TARGET="local"
;;
2)
read -rp "SSH target (login@hostname): " SSH_TARGET
TARGET="ssh"
;;
*)
echo "Invalid choice" >&2
exit 1
;;
esac
echo "==> Building and pushing $IMAGE:$TAG (linux/amd64)..."
docker buildx build --platform linux/amd64 -t "$IMAGE:$TAG" --push .
if [ "$TARGET" = "local" ]; then
echo "==> Deploying locally..."
docker pull "$IMAGE:$TAG"
cd "$DEPLOY_DIR"
docker compose pull
docker compose up -d --remove-orphans
echo "-- Status:"
docker compose ps
echo "==> Done."
else
echo "==> Deploying on $SSH_TARGET..."
ssh "$SSH_TARGET" "
set -euo pipefail
echo '-- Pulling image...'
docker pull $IMAGE:$TAG
echo '-- Restarting container...'
cd $DEPLOY_DIR
docker compose pull
docker compose up -d --remove-orphans
echo '-- Status:'
docker compose ps
"
echo "==> Done."
fi