#!/bin/bash
set -e

# Build the application
echo "Building the application..."
bun run build

# Get the tag or use latest
TAG=$(git describe --tags --exact-match 2>/dev/null || echo "latest")
echo "Building docker image with tag: $TAG"

# Build and push the Docker image
docker build -t docker.site.quack-lab.dev/signaturer:$TAG .
docker push docker.site.quack-lab.dev/signaturer:$TAG

echo "Deployment completed successfully!"