forked from dedis/d-voting
-
Notifications
You must be signed in to change notification settings - Fork 1
68 lines (64 loc) · 2.04 KB
/
build-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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
name: Build docker
on:
push:
branches:
- main
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
jobs:
build-docker:
name: Build D-Voting Docker images
runs-on: ubuntu-22.04
env:
DockerTag: test
push: ${{ (github.ref == 'refs/heads/main') && 'true' || 'true' }}
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set env
run: |
git describe --tags
echo "REACT_APP_VERSION=$(git describe --tags --abbrev=0)" >> $GITHUB_ENV
echo "REACT_APP_BUILD=$(git describe --tags)" >> $GITHUB_ENV
echo "REACT_APP_BUILD_TIME=$(date)" >> $GITHUB_ENV
echo Pushing is ${{ env.push }}
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
- name: Login to GHCR
if: ${{ env.push == 'true' }}
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build Frontend
uses: docker/build-push-action@v2
with:
context: .
file: Dockerfiles/Dockerfile.frontend
platforms: linux/amd64
build-args: |
REACT_APP_VERSION
REACT_APP_BUILD
REACT_APP_BUILD_TIME
push: ${{ env.push }}
tags: ghcr.io/c4dt/d-voting-frontend:${{ env.DockerTag }}
- name: Build Backend
uses: docker/build-push-action@v2
with:
context: .
file: Dockerfiles/Dockerfile.backend
platforms: linux/amd64
push: ${{ env.push }}
tags: ghcr.io/c4dt/d-voting-backend:${{ env.DockerTag }}
- name: Build D-Voting
uses: docker/build-push-action@v2
with:
context: .
file: Dockerfiles/Dockerfile.dela
platforms: linux/amd64
push: ${{ env.push }}
tags: ghcr.io/c4dt/d-voting-dela:${{ env.DockerTag }}