#!/bin/bash

# script/setup: Set up container for the first time after cloning

set -e

cd "$(dirname "$0")/.."

source version

script/bootstrap

echo "==> Setting up container kontor-angular"
if podman image exists localhost/kontor-angular:$kontorVersion; then
    echo "  => Image localhost/kontor-angular:$kontorVersion available"
fi
if podman container exists kontor-angular; then
    if podman ps -q --filter "name=kontor-angular"; then
        echo "  => kontor-angular is running"
    fi
else
    podman run -d \
        --replace \
        --pod kontor \
        --name kontor-angular \
        --label "io.containers.autoupdate=local" \
        --label "PODMAN_SYSTEMD_UNIT=container-kontor-angular.service" \
        localhost/kontor-angular:$kontorVersion
fi

