Files
billing/deploy/deploy.sh
T
dyc12389andClaude Opus 5.5 0b0aceb773 Family bookkeeping PWA modelled on 木木记账
Hono + SQLite server and a React/shadcn PWA with two-level categories,
who-spent/who-paid splits, settlement, one-line and voice entry, budget
alerts (Web Push and Bark), monthly/annual reports, and 木木 import tools.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-29 12:05:39 +08:00

22 lines
1005 B
Bash
Executable File

#!/usr/bin/env bash
# Builds the image locally and ships it to the server (Docker Hub is unreliable
# from mainland China, so the server never pulls images itself).
#
# deploy/deploy.sh build, upload, restart
# HOST=root@1.2.3.4 deploy/deploy.sh
set -euo pipefail
HOST=${HOST:-root@8.133.23.131}
DIR=/opt/billing
cd "$(dirname "$0")/.."
docker buildx build --platform linux/amd64 -t billing:latest --load .
echo "uploading image…"
docker save billing:latest | gzip -1 | ssh "$HOST" 'gunzip | docker load'
ssh "$HOST" "mkdir -p $DIR/data"
scp deploy/docker-compose.yml "$HOST:$DIR/docker-compose.yml"
ssh "$HOST" "test -f $DIR/.env" || scp deploy/env.example "$HOST:$DIR/.env"
# docker-compose 1.29 cannot recreate containers on Docker 25+ (KeyError: 'ContainerConfig'),
# so remove the old container first; data lives in the mounted ./data directory.
ssh "$HOST" "cd $DIR && docker rm -f billing >/dev/null 2>&1; docker-compose up -d && docker image prune -f >/dev/null"
echo "deployed"