#!/bin/bash

current_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
cd "$current_dir" || exit

version=$(awk -F '[<>]' '/<version>/ && !/<parent>/{print $3; exit}' pom.xml)

mvn clean deploy -N -D skipTests -s ~/.m2/settings-nas.xml
mvn -pl leopard-server clean package -D skipTests -s ~/.m2/settings-nas.xml
pnpm -C leopard-web clean && pnpm -C leopard-web build
docker build -t "leopard:latest" --build-arg VERSION="$version" .
