From c0fc5de312d5a200dba8e1c0ae63fee2eb73bcb6 Mon Sep 17 00:00:00 2001 From: stark Date: Wed, 5 Jun 2024 01:15:58 +0100 Subject: [PATCH] Add continuis integration flow --- .github/workflows/deploy.yaml | 35 +++++++++++++++++++++ code/kubernetes/apps/kapend/deplyment.ipynb | 11 +++++++ 2 files changed, 46 insertions(+) create mode 100644 .github/workflows/deploy.yaml diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml new file mode 100644 index 0000000..97b149e --- /dev/null +++ b/.github/workflows/deploy.yaml @@ -0,0 +1,35 @@ +name: Continious Integration flow +on: + push: + branches: + - main + +jobs: + build-and-push: + runs-on: ubuntu-latest + + steps: + - name: Checkout Repository + uses: actions/checkout@v2 + + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: "3.x" + + - name: Login to Docker Hub + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_PASSWORD }} + + - name: Build and Push Docker Image + uses: docker/build-push-action@v2 + with: + context: ./code/docker/4-kapend/myfirst + push: true + tags: ${{ secrets.DOCKERHUB_USERNAME }}/kapend:${{ github.sha }} + + - name: Update Kubernetes Manifest + run: | + sed -i "s|usename/kapend:[a-z0-9]*|${{ secrets.DOCKERHUB_USERNAME }}/kapend:${{ github.sha }}|g" code/docker/4-kapend/myfirst/k8s/03-kapend.yaml diff --git a/code/kubernetes/apps/kapend/deplyment.ipynb b/code/kubernetes/apps/kapend/deplyment.ipynb index caf1742..55a0458 100644 --- a/code/kubernetes/apps/kapend/deplyment.ipynb +++ b/code/kubernetes/apps/kapend/deplyment.ipynb @@ -412,6 +412,17 @@ "microk8s kubectl apply -f app.yaml\n", "```\n" ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Lancer les pod de l'application Django seulement si la base de donnée est prete\n", + "\n", + "```yaml\n", + "\n", + "```" + ] } ], "metadata": {