-
Notifications
You must be signed in to change notification settings - Fork 89
66 lines (57 loc) · 1.98 KB
/
deploy_prod.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
62
63
64
65
66
---
name: Build Docker images and deploy to Production
on:
push:
branches: [ master, main ]
jobs:
build_and_deploy:
runs-on: [self-hosted, docs]
permissions:
packages: write
contents: read
environment:
name: Production
url: https://docs.ukfast.co.uk
steps:
- name: Checkout the repository
uses: actions/checkout@v3
- name: Set up Docker buildx
uses: docker/setup-buildx-action@v2
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push app image
uses: docker/build-push-action@v3
with:
context: .
push: true
tags: ghcr.io/ans-group/docs-app:${{ github.sha }}
build-args: |
essvc=elasticsearch
- name: Build and push populator image
uses: docker/build-push-action@v3
with:
context: .
push: true
tags: ghcr.io/ans-group/docs-populator:${{ github.sha }}
file: populator/Dockerfile
- name: Setup Kustomize
uses: imranismail/setup-kustomize@v2
- name: Build Kustomizations
working-directory: .ci/kustomize
run: |
kustomize create --resources overlays/prod
kustomize edit set image appImage=ghcr.io/ans-group/docs-app:${{ github.sha }}
kustomize edit set image populatorImage=ghcr.io/ans-group/docs-populator:${{ github.sha }}
kustomize edit set namespace docs
kustomize edit set label 'app.kubernetes.io/instance:prod'
kustomize build . > ../../manifest.yaml
- name: Setup kubectl
uses: azure/[email protected]
- name: Create/Update resources in Kubernetes
run: |
echo -e "${{ secrets.PROD_KUBECONFIG_ANS }}" > kubeconfig.yaml
kubectl --kubeconfig kubeconfig.yaml apply -f manifest.yaml