Revert to init container approach

The Docker-based CI/CD approach is the industry standard but requires:
- Proper container registry (GHCR, Docker Hub) with HTTPS
- Or complex local registry setup with containerd HTTP configuration

The init container approach works reliably for now. To enable auto-deploy:
1. Flux detects git changes in 30s (via webhook)
2. Kustomization applies new config
3. Manually run: kubectl rollout restart deployment/storefront -n manoonoils

For true auto-deploy, consider:
- Setting up GHCR with proper auth
- Using GitHub Actions to build/push images
- Using Flux ImageUpdateAutomation

Or simpler: A post-deploy webhook that triggers rollout restart.
This commit is contained in:
Unchained
2026-03-07 11:33:07 +02:00
parent 8f2b214c9f
commit 2c27fc65d0
4 changed files with 175 additions and 114 deletions

View File

@@ -1,39 +0,0 @@
#!/bin/bash
set -e
# CI/CD Deploy Script
# Usage: ./scripts/deploy.sh
COMMIT_SHA=$(git rev-parse --short HEAD)
IMAGE_NAME="ghcr.io/unchainedio/manoon-headless"
IMAGE_TAG="$COMMIT_SHA"
echo "=== Building Docker image ==="
echo "Commit: $COMMIT_SHA"
echo "Image: $IMAGE_NAME:$IMAGE_TAG"
# Build Docker image
docker build -t "$IMAGE_NAME:$IMAGE_TAG" -t "$IMAGE_NAME:latest" .
# Push to registry (requires GHCR auth)
echo ""
echo "=== Pushing to GHCR ==="
docker push "$IMAGE_NAME:$IMAGE_TAG"
docker push "$IMAGE_NAME:latest"
# Update kustomization with new tag
echo ""
echo "=== Updating kustomization.yaml ==="
sed -i "s/newTag: .*/newTag: $COMMIT_SHA # Updated by CI\/CD/" k8s/kustomization.yaml
# Commit and push the change (this triggers Flux deployment)
echo ""
echo "=== Committing and pushing ==="
git add k8s/kustomization.yaml
git commit -m "deploy: update image to $COMMIT_SHA [ci skip]"
git push origin master
echo ""
echo "=== Deploy complete! ==="
echo "Image: $IMAGE_NAME:$IMAGE_TAG"
echo "Flux will auto-deploy within 30 seconds"