Legg til build.sh, run.sh og .env.example

build.sh bygger imaget med build-dato og git-revisjon, run.sh starter
containeren idempotent (podman run --replace) med innstillinger fra .env.
compose.yaml leser nå samme .env. Alle variabler har standardverdier;
.env.example dokumenterer dem.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JcEy43fNYpwg6K6oTKakWR
This commit is contained in:
Ole-Morten Duesund 2026-08-26 12:36:12 +02:00
commit 5f6fc252a7
6 changed files with 89 additions and 15 deletions

28
run.sh Executable file
View file

@ -0,0 +1,28 @@
#!/usr/bin/env bash
# Starter (eller erstatter) soapbox-containeren med innstillinger fra .env.
# Idempotent: kjør på nytt etter build.sh for å rulle ut nytt image.
set -euo pipefail
cd "$(dirname "$0")"
ENV_FILE="${ENV_FILE:-.env}"
if [[ ! -f "$ENV_FILE" ]]; then
echo "Fant ikke $ENV_FILE kopier .env.example til .env og juster." >&2
exit 1
fi
# Verdier som bare gjelder for podman-kjøringen (ikke appen)
PORT="$(grep -E '^SOAPBOX_PORT=' "$ENV_FILE" | cut -d= -f2- || true)"
VOLUME="$(grep -E '^SOAPBOX_VOLUME=' "$ENV_FILE" | cut -d= -f2- || true)"
PORT="${PORT:-8080}"
VOLUME="${VOLUME:-soapbox-data}"
IMAGE="${1:-localhost/soapbox:latest}"
podman run -d --replace --name soapbox \
--restart unless-stopped \
-p "127.0.0.1:${PORT}:8080" \
-v "${VOLUME}:/data:Z" \
--env-file "$ENV_FILE" \
"$IMAGE"
echo "soapbox kjører på http://127.0.0.1:${PORT}/ (data i ${VOLUME})"
echo "Logger: podman logs -f soapbox"