-
Notifications
You must be signed in to change notification settings - Fork 0
76 lines (69 loc) · 2.16 KB
/
backend.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
71
72
73
74
75
76
name: backend
on:
workflow_dispatch:
push:
paths:
- ".github/workflows/backend.yml"
- "backend/**"
- "nginx/**"
- "simplesamlphp/**"
- "Dockerfile*"
jobs:
backend:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build nginx container
uses: docker/build-push-action@v6
with:
context: .
file: Dockerfile.nginx
load: true
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Build fpm container
uses: docker/build-push-action@v6
with:
context: .
file: Dockerfile.fpm
load: true
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Push nginx container
id: nginx_docker_build
if: github.ref == 'refs/heads/main'
uses: docker/build-push-action@v6
with:
context: .
file: Dockerfile.nginx
push: true
tags: blindernuka/billett-proxy:latest
- name: Push fpm container
id: fpm_docker_build
if: github.ref == 'refs/heads/main'
uses: docker/build-push-action@v6
with:
context: .
file: Dockerfile.fpm
push: true
tags: blindernuka/billett-backend:latest
- name: Deploy
if: github.ref == 'refs/heads/main'
run: |
curl --fail -L -i -H "authorization: bearer $DEPLOYER_TOKEN" -H "content-type: application/json" -X POST https://deployer.foreningenbs.no/deploy -d '
{
"service": "uka-billett",
"attributes": {
"fpm_image": "blindernuka/billett-backend@${{ steps.fpm_docker_build.outputs.digest }}",
"proxy_image": "blindernuka/billett-proxy@${{ steps.nginx_docker_build.outputs.digest }}"
}
}'
env:
DEPLOYER_TOKEN: ${{ secrets.DEPLOYER_TOKEN }}