commit fa487b38b0b63938efae03913c91975d85593334 Author: sayudhalw Date: Fri Aug 28 10:55:57 2026 +0000 Aplikasi uji CI/CD versi 1 diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml new file mode 100644 index 0000000..92437a2 --- /dev/null +++ b/.gitea/workflows/deploy.yml @@ -0,0 +1,49 @@ +name: Build dan Deploy + +on: + push: + branches: [main] + workflow_dispatch: + +env: + REGISTRY: 192.168.0.121:3000 + IMAGE: 192.168.0.121:3000/sayudhalw/hello-ci + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Bangun image + run: | + docker build -t "$IMAGE:${{ github.sha }}" -t "$IMAGE:latest" . + + - name: Kirim ke registry + run: | + docker push "$IMAGE:${{ github.sha }}" + docker push "$IMAGE:latest" + + - name: Deploy ke staging + run: | + ssh -o StrictHostKeyChecking=no root@192.168.0.118 \ + "deploy hello-ci $IMAGE:${{ github.sha }} 8081 80" + + - name: Pastikan staging hidup + run: | + sleep 5 + curl -fsS -o /dev/null -w 'staging HTTP %{http_code}\n' http://192.168.0.118:8081 + + produksi: + runs-on: ubuntu-latest + needs: build + if: github.event_name == 'workflow_dispatch' + steps: + - name: Deploy ke production + run: | + ssh -o StrictHostKeyChecking=no root@192.168.0.119 \ + "deploy hello-ci $IMAGE:${{ github.sha }} 8081 80" + - name: Pastikan production hidup + run: | + sleep 5 + curl -fsS -o /dev/null -w 'production HTTP %{http_code}\n' http://192.168.0.119:8081 diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..5ef646a --- /dev/null +++ b/Dockerfile @@ -0,0 +1,2 @@ +FROM nginx:alpine +COPY index.html /usr/share/nginx/html/index.html diff --git a/index.html b/index.html new file mode 100644 index 0000000..bb93ff0 --- /dev/null +++ b/index.html @@ -0,0 +1,5 @@ + +hello-ci + +

hello-ci

Versi 1 — dibangun otomatis oleh Gitea Actions