#!/usr/bin/env sh set -eu APP_DIR=${APP_DIR:-/opt/intradesk-monitor} COMPOSE_FILE=${COMPOSE_FILE:-docker-compose.deploy.yml} cd "$APP_DIR" mkdir -p data deploy if [ ! -f .env ]; then echo ".env is missing in $APP_DIR. Create it from .env.example before the first deploy." >&2 exit 1 fi if [ -n "${IMAGE_REPO:-}" ] && [ -n "${IMAGE_TAG:-}" ]; then cat > .env.runtime <&2 exit 1 fi set -a . ./.env.runtime set +a if [ "${PULL_IMAGE:-0}" = "1" ]; then docker compose -f "$COMPOSE_FILE" pull fi docker compose -f "$COMPOSE_FILE" up -d --remove-orphans docker image prune -f >/dev/null 2>&1 || true