-
Notifications
You must be signed in to change notification settings - Fork 1
47 lines (45 loc) · 1.54 KB
/
docker.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
name: build docker image
on: push
jobs:
docker:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: build client webpack
run: |
cd frontend/
npm ci
npm run js
- name: prepare server
run: |
cd api/
npm ci
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Docker meta
id: meta
uses: crazy-max/ghaction-docker-meta@v2
with:
images: harbor.cs.dm.unipi.it/caps/caps
tags: api
- name: Login to harbor
uses: docker/login-action@v3
if: ${{ github.event_name != 'pull_request' }}
with:
registry: harbor.cs.dm.unipi.it
username: ${{ secrets.HARBOR_CAPS_ROBOT }}
password: ${{ secrets.HARBOR_CAPS_SECRET }}
- name: Build and push
id: docker_build
uses: docker/build-push-action@v2
if: ${{ github.event_name != 'pull_request' }}
with:
push: true
cache-from: type=registry,ref=harbor.cs.dm.unipi.it/caps/caps:api
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
- name: Trigger update on Watchtower
if: ${{ github.event_name != 'pull_request' }}
run: |
curl -H "Authorization: Bearer ${{ secrets.WATCHTOWER_CAPS_SECRET }}" https://watchtower.caps.dm.unipi.it/v1/update
curl -H "Authorization: Bearer ${{ secrets.WATCHTOWER_SECRET }}" https://watchtower.pi.cs.dm.unipi.it/v1/update