-
Notifications
You must be signed in to change notification settings - Fork 1
52 lines (44 loc) · 1.15 KB
/
main.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
name: CI-CD
on:
workflow_dispatch:
push:
env:
docker_image: fabricioveronez/nodejs-web
jobs:
CI:
runs-on: ubuntu-latest
steps:
- name: Obtendo o código
uses: actions/checkout@v4
- name: Docker Login
uses: docker/login-action@v3
with:
username: ${{secrets.DOCKERHUB_USER}}
password: ${{secrets.DOCKERHUB_PWD}}
- name: Construção da imagem Docker worker
uses: docker/build-push-action@v5
with:
context: ./src
file: ./src/Dockerfile
push: true
tags: |
"${{ env.docker_image }}:${{github.run_number}}"
"${{ env.docker_image }}:latest"
CD:
runs-on: ubuntu-latest
needs: [CI]
steps:
- name: Obtendo o código
uses: actions/checkout@v3
- name: Configuração do Kubeconfig
uses: azure/k8s-set-context@v4
with:
method: kubeconfig
kubeconfig: ${{ secrets.K8S_CONFIG }}
- name: Deploy no cluster Kubernetes
uses: Azure/k8s-deploy@v5
with:
manifests: |
./k8s/deployment.yaml
images: |
"${{ env.docker_image }}:${{github.run_number}}"