feat: implement file deletion functionality and enhance deployment script

This commit is contained in:
Anders Böttcher
2026-05-13 12:35:58 +02:00
parent cf23467be6
commit 9dbbf814b4
10 changed files with 229 additions and 50 deletions
+29 -12
View File
@@ -1,22 +1,39 @@
#!/usr/bin/env bash
# deploy.sh — Build the image and start (or restart) the local stack.
# Usage: ./docker/deploy.sh [TAG]
# TAG defaults to "backerup-website:latest"
# deploy.sh — Build the image locally and start (or restart) the stack.
#
# Usage:
# ./docker/deploy.sh # rebuild & restart, keep existing data
# ./docker/deploy.sh --fresh # rebuild & restart, wipe all data volumes first
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
TAG="${1:-gitea.doomlabs.de/kptltd00m/backerup-website:latest}"
FRESH=false
# 1. Build
"$SCRIPT_DIR/build.sh" "$TAG"
for arg in "$@"; do
case "$arg" in
--fresh) FRESH=true ;;
*) echo "Unknown argument: $arg" >&2; exit 1 ;;
esac
done
# 2. Export the image tag so docker compose picks it up if you override it
export BACKERUP_IMAGE="$TAG"
# 3. Bring the stack up (recreate on image change)
echo "==> Starting stack via docker compose…"
# Stop and remove existing containers
echo "==> Stopping existing containers…"
docker compose \
--file "$SCRIPT_DIR/docker-compose.yml" \
up --detach --pull never --remove-orphans
down --remove-orphans 2>/dev/null || true
# Optionally wipe data volumes
if [ "$FRESH" = true ]; then
echo "==> --fresh: removing data volumes…"
docker compose \
--file "$SCRIPT_DIR/docker-compose.yml" \
down --volumes 2>/dev/null || true
fi
# Build image and bring the stack up
echo "==> Building and starting stack via docker compose…"
docker compose \
--file "$SCRIPT_DIR/docker-compose.yml" \
up --build --detach --remove-orphans
echo "==> Backerup website is running at http://localhost:3000"