mirror of
https://gitlab.w-hs.de/an14051/backerup-website.git
synced 2026-07-27 17:35:29 +00:00
feat: implement file deletion functionality and enhance deployment script
This commit is contained in:
+29
-12
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user