PFEE/dashboard-sqdc/.gitea/workflows/build-deploy.yml
Alexis Bruneteau 770c41d5e0 feat: Add Shadcn UI, dark theme, and complete Docker/K8s deployment setup
Major Changes:
- Migrate UI to Shadcn components with Tailwind CSS v3
- Implement dark theme as default with improved color scheme
- Optimize homepage layout to fit single screen without scrolling
- Fix chart visibility with explicit colors for dark mode

Deployment Infrastructure:
- Add Docker multi-stage build with Nginx + Node.js
- Create Kubernetes manifests (deployment, service, ingress, PVC)
- Configure Gitea CI/CD workflow with registry integration
- Add deployment scripts with registry support

CI/CD Configuration:
- Registry: gitea.vidoks.fr/sortifal/pfee
- Automatic build and push on commits
- Kubernetes deployment with image pull secrets
- Three-stage pipeline: build, deploy, notify

Documentation:
- Add DEPLOYMENT.md with comprehensive deployment guide
- Add SETUP-REGISTRY.md with step-by-step registry setup
- Add workflow README with troubleshooting guide
- Include configuration examples and best practices

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-22 00:42:32 +02:00

110 lines
3.2 KiB
YAML

name: Build and Deploy SQDC Dashboard
on:
push:
branches:
- main
- dashboard
pull_request:
branches:
- main
- dashboard
jobs:
build:
name: Build Docker Image
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '18'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Run tests
run: npm test -- --passWithNoTests
- name: Build application
run: npm run build
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to Container Registry
run: |
echo "${{ secrets.REGISTRY_PASSWORD }}" | docker login ${{ secrets.REGISTRY_URL }} -u ${{ secrets.REGISTRY_USER }} --password-stdin
- name: Build and Push Docker image
run: |
docker build -t ${{ secrets.REGISTRY_URL }}/sortifal/pfee:${{ github.sha }} .
docker tag ${{ secrets.REGISTRY_URL }}/sortifal/pfee:${{ github.sha }} ${{ secrets.REGISTRY_URL }}/sortifal/pfee:latest
docker push ${{ secrets.REGISTRY_URL }}/sortifal/pfee:${{ github.sha }}
docker push ${{ secrets.REGISTRY_URL }}/sortifal/pfee:latest
deploy:
name: Deploy to Kubernetes
runs-on: ubuntu-latest
needs: build
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/dashboard'
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up kubectl
uses: azure/setup-kubectl@v3
with:
version: 'latest'
- name: Configure kubectl
run: |
mkdir -p $HOME/.kube
echo "${{ secrets.KUBE_CONFIG }}" > $HOME/.kube/config
- name: Create registry credentials secret
run: |
kubectl create secret docker-registry registry-credentials \
--docker-server=${{ secrets.REGISTRY_URL }} \
--docker-username=${{ secrets.REGISTRY_USER }} \
--docker-password=${{ secrets.REGISTRY_PASSWORD }} \
-n sqdc-dashboard \
--dry-run=client -o yaml | kubectl apply -f -
- name: Deploy to Kubernetes
run: |
kubectl apply -f k8s/namespace.yaml
kubectl apply -f k8s/deployment.yaml
kubectl apply -f k8s/service.yaml
kubectl apply -f k8s/ingress.yaml
- name: Update deployment with new image
run: |
kubectl set image deployment/sqdc-dashboard dashboard=${{ secrets.REGISTRY_URL }}/sortifal/pfee:${{ github.sha }} -n sqdc-dashboard
kubectl rollout status deployment/sqdc-dashboard -n sqdc-dashboard --timeout=5m
- name: Verify deployment
run: |
kubectl get pods -n sqdc-dashboard
kubectl get svc -n sqdc-dashboard
kubectl get ingress -n sqdc-dashboard
notify:
name: Notify Deployment Status
runs-on: ubuntu-latest
needs: [build, deploy]
if: always()
steps:
- name: Deployment Status
run: |
if [ "${{ needs.deploy.result }}" == "success" ]; then
echo "✅ Deployment successful!"
else
echo "❌ Deployment failed!"
exit 1
fi