-
Notifications
You must be signed in to change notification settings - Fork 6
53 lines (50 loc) · 1.51 KB
/
build-and-release-crapi-web.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
name: Build crAPI web service
on:
pull_request:
paths:
- '.github/workflows/build-and-release-crapi-web.yml'
- 'crAPI/services/web/**'
push:
paths:
- '.github/workflows/build-and-release-crapi-web.yml'
- 'crAPI/services/web/**'
branches:
- main
tags:
- v*
workflow_dispatch:
jobs:
build-and-push-image:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Build image
if: ${{ github.event_name == 'pull_request' || github.ref != 'refs/heads/main' }}
uses: docker/build-push-action@v5
with:
context: ./crAPI/services/web
load: true
cache-from: type=gha
cache-to: type=gha,mode=max
tags: levoai/crapi-web:pr-build
- name: Build and push
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
uses: docker/build-push-action@v5
with:
context: ./crAPI/services/web
platforms: linux/amd64,linux/arm64
push: true
tags: levoai/crapi-web:latest
cache-from: type=gha
cache-to: type=gha,mode=max