#!/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-vue"
if podman image exists localhost/kontor-vue:$kontorVersion; then
    echo "  => Image localhost/kontor-vue:$kontorVersion available"
fi
if podman container exists kontor-vue; then
    if podman ps -q --filter "name=kontor-vue"; then
        echo "  => kontor-vue is running"
    fi
else
    podman run -d \
        --replace \
        --pod kontor \
        --name kontor-vue \
        --label "io.containers.autoupdate=local" \
        --label "PODMAN_SYSTEMD_UNIT=kontor-vue.service" \
        localhost/kontor-vue:$kontorVersion
fi

