-
Notifications
You must be signed in to change notification settings - Fork 0
77 lines (66 loc) · 2.51 KB
/
k8s.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
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
name: Docker Image CI
env:
CLUSTER_NAME: multi-client-cluster
CLUSTER_RESOURCE_GROUP: aks-cluster
NAMESPACE: default
APP_NAME: multi-client-cluster
on:
push:
branches: [ master ]
workflow_dispatch:
inputs:
logLevel:
description: 'Log level'
required: true
default: 'warning'
type: choice
options:
- info
- warning
- debug
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: azure/login@v1.4.4
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
- uses: azure/aks-set-context@v2.0
with:
cluster-name: ${{ env.CLUSTER_NAME }}
resource-group: ${{ env.CLUSTER_RESOURCE_GROUP }}
- name: Login to Docker
run: docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }}
- name: Build the Dev Docker image
run: docker build -f ./client/Dockerfile.dev -t sanyaaxel/multi-docker-client-test ./client
- name: Run Tests
run: docker run -e CI=true sanyaaxel/multi-docker-client-test npm test -- --coverage
- name: Build the Prod Docker Client image
run: docker build -t sanyaaxel/multi-docker-client:${{ github.sha }} -t sanyaaxel/multi-docker-client:latest ./client
- name: Build the Prod Docker API image
run: docker build -t sanyaaxel/multi-docker-api:${{ github.sha }} -t sanyaaxel/multi-docker-api:latest ./server
- name: Build the Prod Docker Worker image
run: docker build -t sanyaaxel/multi-docker-worker:${{ github.sha }} -t sanyaaxel/multi-docker-worker:latest ./worker
- name: Publish Client latest
run: docker push sanyaaxel/multi-docker-client:latest
- name: Publish API latest
run: docker push sanyaaxel/multi-docker-api:latest
- name: Publish Worker latest
run: docker push sanyaaxel/multi-docker-worker:latest
- name: Publish Client
run: docker push sanyaaxel/multi-docker-client:${{ github.sha }}
- name: Publish API
run: docker push sanyaaxel/multi-docker-api:${{ github.sha }}
- name: Publish Worker
run: docker push sanyaaxel/multi-docker-worker:${{ github.sha }}
- name: Deploy to Kubernetes cluster
uses: Azure/k8s-deploy@v3.1
with:
manifests: |
${{ github.workspace }}/k8s
pull-images: true
images: |
sanyaaxel/multi-docker-client:${{ github.sha }}
sanyaaxel/multi-docker-api:${{ github.sha }}
sanyaaxel/multi-docker-worker:${{ github.sha }}