#!/bin/bash # Deploy whalehunting to Kubernetes via ArgoCD # Prerequisites: # 1. Create repo in Gitea: git.kube2.tricnet.de/admin/whalehunting # 2. Push this repo to Gitea # 3. Run this script to create the ArgoCD application set -e GITEA_URL="git.kube2.tricnet.de" REPO_NAME="whalehunting" IMAGE_TAG="${1:-latest}" echo "=== Whalehunting Kubernetes Deployment ===" echo "" # Step 1: Build and push Docker image to Gitea registry echo "1. Building Docker image..." docker build -t ${GITEA_URL}/admin/${REPO_NAME}:${IMAGE_TAG} . echo "" echo "2. Pushing image to Gitea registry..." echo " (You may need to: docker login ${GITEA_URL})" docker push ${GITEA_URL}/admin/${REPO_NAME}:${IMAGE_TAG} echo "" echo "3. Updating image tag in kustomization.yaml..." sed -i "s/newTag: .*/newTag: ${IMAGE_TAG}/" k8s/kustomization.yaml echo "" echo "4. Committing and pushing to Gitea..." git add -A git commit -m "deploy: update image to ${IMAGE_TAG}" || echo "No changes to commit" git push origin master echo "" echo "5. Creating/updating ArgoCD application..." ssh root@kube2.tricnet.de "kubectl apply -f -" < k8s/argocd-application.yaml echo "" echo "=== Deployment initiated ===" echo "ArgoCD will sync automatically." echo "" echo "Check status:" echo " ssh root@kube2.tricnet.de 'kubectl get application whalehunting -n argocd'" echo "" echo "Game URL: https://whalehunting.kube2.tricnet.de"