-
Notifications
You must be signed in to change notification settings - Fork 0
60 lines (54 loc) · 1.75 KB
/
docker-build.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
name: Build wacs Docker Image
on:
push:
paths:
- 'wacs-gitea/**'
- '.github/workflows/docker-build.yml'
pull_request:
workflow_dispatch:
jobs:
#build and publish image
Build-Image:
name: Build image
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: docker/setup-qemu-action@v2
- uses: docker/setup-buildx-action@v2
- name: Build image with buildx
uses: docker/build-push-action@v3
with:
context: ./wacs-gitea
cache-from: type=gha
cache-to: type=gha,mode=max
Push-Image:
name: Push images if this is a branch
runs-on: ubuntu-latest
needs: [Build-Image]
if: ${{ contains(fromJson('["push"]'), github.event_name) }}
steps:
- uses: actions/checkout@v3
- uses: FranzDiebold/[email protected]
- uses: docker/setup-qemu-action@v2
- uses: docker/setup-buildx-action@v2
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_HUB_USER }}
password: ${{ secrets.DOCKER_HUB_TOKEN }}
- name: Set docker tags
run: |
echo "TAG_SHA=wycliffeassociates/wacs:$GITHUB_SHA" >> $GITHUB_ENV && \
echo "TAG_BRANCH=wycliffeassociates/wacs:$CI_REF_NAME_SLUG" >> $GITHUB_ENV && \
echo "TAG_LATEST=wycliffeassociates/wacs:latest" >> $GITHUB_ENV
- name: Build and conditional push API image
uses: docker/build-push-action@v3
with:
context: ./wacs-gitea
push: true
tags: |
${{ env.TAG_SHA }}
${{ env.TAG_BRANCH }}
${{ env.TAG_LATEST }}
cache-from: type=gha
cache-to: type=gha,mode=max