-
Notifications
You must be signed in to change notification settings - Fork 1
70 lines (58 loc) · 2.29 KB
/
deploy.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
67
68
69
70
name: Build app and update Docker image
on:
push:
branches:
- master
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set variables
id: vars
run: |
echo "::set-output name=sha_short::$(git rev-parse --short HEAD)"
echo "::set-output name=docker_image_php_fpm::ghcr.io/netwerk-digitaal-erfgoed/registry-demo-php-fpm"
echo "::set-output name=docker_image_nginx::ghcr.io/netwerk-digitaal-erfgoed/registry-demo-nginx"
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
with:
# See https://github.com/docker/build-push-action/issues/126.
driver-opts: image=moby/buildkit:master
- name: Log in to Docker registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.CONTAINER_REGISTRY_TOKEN }}
- name: Build and push image to registry
uses: docker/build-push-action@v2
with:
context: .
file: docker/nginx/Dockerfile
push: true
tags: |
${{ steps.vars.outputs.docker_image_nginx }}:${{ steps.vars.outputs.sha_short }}
${{ steps.vars.outputs.docker_image_nginx }}:latest
- name: Build and push image to registry
uses: docker/build-push-action@v2
with:
context: .
file: docker/php-fpm/Dockerfile
push: true
tags: |
${{ steps.vars.outputs.docker_image_php_fpm }}:${{ steps.vars.outputs.sha_short }}
${{ steps.vars.outputs.docker_image_php_fpm }}:latest
- uses: digitalocean/action-doctl@v2
with:
token: ${{ secrets.DIGITALOCEAN_ACCESS_TOKEN }}
- name: Store DigitalOcean credentials
run: doctl kubernetes cluster kubeconfig save nde
- name: Update stateful set
run: |
kubectl set image statefulset/registry-demo \
nginx=${{ steps.vars.outputs.docker_image_nginx }}:${{ steps.vars.outputs.sha_short }} \
php=${{ steps.vars.outputs.docker_image_php_fpm }}:${{ steps.vars.outputs.sha_short }} \
--record
- name: Verify stateful set
run: kubectl rollout status statefulset/registry-demo