Add GoldPi Email-Forwarder test container deploy
This commit is contained in:
parent
91e52aecd0
commit
8a6160817b
8 changed files with 143 additions and 0 deletions
|
|
@ -0,0 +1,51 @@
|
|||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
cd "$(dirname "$0")"
|
||||
set -a
|
||||
source ./config.env
|
||||
set +a
|
||||
|
||||
mkdir -p "$APP_DIR/data" "$APP_DIR/backup" "$APP_DIR/build" "$APP_DIR/export"
|
||||
|
||||
if [ ! -d "$BUILD_SRC" ]; then
|
||||
echo "BUILD_SRC missing: $BUILD_SRC" >&2
|
||||
exit 2
|
||||
fi
|
||||
|
||||
podman exec -w /work/Email-Forwarder "$DEVOP_CONTAINER" bash -lc '
|
||||
set -euo pipefail
|
||||
mkdir -p frontend-js/dist
|
||||
if [ ! -f frontend-js/dist/htmx.min.js ]; then
|
||||
curl -fsSL https://unpkg.com/htmx.org@1.9.12/dist/htmx.min.js -o frontend-js/dist/htmx.min.js
|
||||
fi
|
||||
go mod tidy
|
||||
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -trimpath -ldflags "-s -w" -o emailforwarder .
|
||||
'
|
||||
|
||||
install -m0755 "$BUILD_SRC/emailforwarder" "$APP_DIR/build/emailforwarder"
|
||||
if [ ! -f "$APP_DIR/config.json" ]; then
|
||||
install -m0644 "$APP_DIR/config.json.example" "$APP_DIR/config.json"
|
||||
fi
|
||||
install -m0644 "$APP_DIR/config.json" "$APP_DIR/build/config.json"
|
||||
install -m0644 "$APP_DIR/Containerfile" "$APP_DIR/build/Containerfile"
|
||||
|
||||
podman build -t "$IMAGE_NAME" -f "$APP_DIR/build/Containerfile" "$APP_DIR/build"
|
||||
|
||||
podman rm -f "$CONTAINER_NAME" >/dev/null 2>&1 || true
|
||||
podman pod rm -f "$POD_NAME" >/dev/null 2>&1 || true
|
||||
podman pod create --name "$POD_NAME" --network "$NETWORK" -p "$HOST_BIND:$APP_PORT:$APP_PORT" >/dev/null
|
||||
podman run -d --name "$CONTAINER_NAME" --pod "$POD_NAME" \
|
||||
--restart=unless-stopped \
|
||||
-v "$APP_DIR/data:/app/data:Z" \
|
||||
-v "$APP_DIR/backup:/app/backup:Z" \
|
||||
"$IMAGE_NAME" >/dev/null
|
||||
|
||||
for _ in {1..20}; do
|
||||
if curl -fsS "http://$HOST_BIND:$APP_PORT/" >/dev/null 2>&1; then
|
||||
echo "Email-Forwarder reachable at http://$HOST_BIND:$APP_PORT/"
|
||||
exit 0
|
||||
fi
|
||||
sleep 1
|
||||
done
|
||||
|
||||
curl -fsS "http://$HOST_BIND:$APP_PORT/" >/dev/null
|
||||
Loading…
Add table
Add a link
Reference in a new issue