my-app-sandbox/.github/workflows/deploy.yml
bast 1a663b0d17
Some checks failed
Build, Push and GitOps Deploy / test-and-deploy (push) Failing after 9s
.github/workflows/deploy.yml aktualisiert
2026-10-31 13:54:37 +00:00

49 lines
1.8 KiB
YAML

name: Build, Push and GitOps Deploy
on:
push:
branches: [ "main" ]
workflow_dispatch:
jobs:
test-and-deploy:
runs-on: ubuntu-latest
container: catthehacker/ubuntu:act-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Activate Included Terraform Binary
run: |
mv ./terraform /usr/local/bin/terraform 2>/dev/null || echo "Nutze vorhandenes File"
chmod +x /usr/local/bin/terraform
terraform --version
# KORRIGIERT: Spricht das Zertifikat exakt über localhost:3000 an und leitet es intern an nginx weiter
- name: Log in to Local Registry
run: |
echo "${{ secrets.GITHUB_TOKEN }}" | docker login --add-host=localhost:127.0.0.1 localhost:3000 -u ${{ github.actor }} --password-stdin
# KORRIGIERT: Taggt das Image passend zur localhost-Registry
- name: Build App Image
run: |
docker build --add-host=localhost:127.0.0.1 -t localhost:3000/${{ github.repository }}:${{ github.sha }} .
docker build --add-host=localhost:127.0.0.1 -t localhost:3000/${{ github.repository }}:latest .
# KORRIGIERT: Pusht verschlüsselt über das Nginx-SSL-Tor auf Port 3000
- name: Push App Image
run: |
docker push localhost:3000/${{ github.repository }}:${{ github.sha }}
docker push localhost:3000/${{ github.repository }}:latest
- name: Terraform Deploy
run: |
terraform init
terraform apply -auto-approve -var="app_version=${{ github.sha }}"
- name: Verify App Health
run: |
echo "Warte auf das Ingress-Routing..."
sleep 15
curl --fail --connect-timeout 5 http://local-k3s-platform:80/ || exit 1
echo "Erfolg: Die App läuft fehlerfrei nach dem Update!"