-
Notifications
You must be signed in to change notification settings - Fork 0
32 lines (26 loc) · 1.4 KB
/
build-and-deploy.yaml
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
name: Build and Deploy
on:
push:
branches:
- main
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Build and Push Frontend Docker Image
run: |
docker build -t registry.digitalocean.com/docshow-ai/frontend-prod:latest -f frontend/Dockerfile.prod frontend/
echo ${{ secrets.REGISTRY_PASSWORD }} | docker login registry.digitalocean.com -u ${{ secrets.REGISTRY_USERNAME }} --password-stdin
docker push registry.digitalocean.com/docshow-ai/frontend-prod:latest
- name: Build and Push Backend Docker Image
run: |
docker build -t registry.digitalocean.com/docshow-ai/backend-prod:latest -f backend/Dockerfile.prod backend/
echo ${{ secrets.REGISTRY_PASSWORD }} | docker login registry.digitalocean.com -u ${{ secrets.REGISTRY_USERNAME }} --password-stdin
docker push registry.digitalocean.com/docshow-ai/backend-prod:latest
- name: Set up Kubectl and Update Deployment
run: |
echo "${{ secrets.KUBECONFIG_SECRET }}" | base64 --decode > kubeconfig.yml
kubectl --kubeconfig=kubeconfig.yml set image deployment/frontend-deployment frontend=registry.digitalocean.com/docshow-ai/frontend-prod:latest
kubectl --kubeconfig=kubeconfig.yml set image deployment/backend-deployment backend=registry.digitalocean.com/docshow-ai/backend-prod:latest