-
Notifications
You must be signed in to change notification settings - Fork 0
61 lines (50 loc) · 1.76 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
53
54
55
56
57
58
59
60
61
name: Docker Build and Kubernetes Deploy
on:
workflow_dispatch:
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
# - name: Build and push Docker images
# run: |
# docker build -t hellopradum/backend-wanderlust backend/.
# docker build -t hellopradum/frontend-wanderlust frontend/.
# docker push hellopradum/backend-wanderlust:latest
# docker push hellopradum/frontend-wanderlust:latest
- name: Install kubectl
run: |
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
chmod +x kubectl
sudo mv kubectl /usr/local/bin/
- name: Configure kubectl
run: |
mkdir -p ~/.kube
echo "${{ secrets.KUBE_CONFIG }}" | base64 --decode > ${HOME}/.kube/config
cat ${HOME}/.kube/config
kubectl version --client
- name: Create and claim persistent volume
run: |
cd kubernetes
kubectl apply -f persistentVolume.yaml
kubectl apply -f persistentVolumeClaim.yaml
- name: Deploy MongoDB
run: |
kubectl apply -f mongodb.yaml
- name: Deploy Redis
run: |
kubectl apply -f redis.yaml
- name: Deploy Backend
run: |
kubectl apply -f backend.yaml
- name: Deploy Frontend
run: |
kubectl apply -f frontend.yaml