Skip to content

Commit

Permalink
Merge pull request #49 from raulc27/dev
Browse files Browse the repository at this point in the history
adicionando github workflow e k8s para deploy
  • Loading branch information
raulc27 committed Sep 14, 2023
2 parents 991557e + 6da3e64 commit 1435cd3
Show file tree
Hide file tree
Showing 2 changed files with 79 additions and 0 deletions.
45 changes: 45 additions & 0 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: CI-CD

on:
push:
branches: [ main ]

workflow_dispatch:

jobs:
CI:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Docker Login
uses: docker/login-action@v1.10.0
with:
username: ${{ secrets.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_PWD }}

- name: Docker Build and Push
uses: docker/build-push-action@v2.7.0
with:
context: ./src
file: ./src/Dockerfile
push: true
tags: |
raulc27/pandemia:latest
raulc27/pandemia:${{ github.run_number }}
CD:
needs: [CI]
runs-on: ubuntu-latest
steps:
- uses: actions:/checkout@v2
- name: Kubernetes set context
uses: Azure/k8s-set-context@v1.1
with:
method: kubeconfig
kubeconfig: ${{secrets.K8S_KUBECONFIG}}
- name: Deploy to Kubernetes Cluster
uses: Azure/k8s-deploy@v1.3
with:
images: raulc27/pandemia:${{ github.run_number }}
manifests: |
k8s/Deployment.yaml
34 changes: 34 additions & 0 deletions k8s/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#APP PANDEMIA
apiVersion: apps/v1
kind: Deployment
metadata:
name: pandemia
spec:
replicas: 1
selector:
matchLabels:
app: pandemia
template:
metadata:
labels:
app: pandemia
spec:
containers:
- name: pandemia
image: raulc27/pandemia:latest
ports:
- containerPort: 5000
---
# Service da aplicação
apiVersion: v1
kind: Service
metadata:
name: pandemia
spec:
selector:
app: pandemia
ports:
- port: 80
targetPort: 5000
nodePort: 30000
type: NodePort

0 comments on commit 1435cd3

Please sign in to comment.