forked from fossology/fossology
-
Notifications
You must be signed in to change notification settings - Fork 6
66 lines (56 loc) · 1.79 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
61
62
63
64
65
66
# SPDX-FileCopyrightText: © 2021 Siemens AG
# SPDX-FileCopyrightText: © Gaurav Mishra <[email protected]>
# SPDX-License-Identifier: GPL-2.0-only AND LGPL-2.1-only
name: Docker images - master
concurrency:
group: docker-${{ github.head_ref }}
cancel-in-progress: true
on:
push:
branches:
- master
release:
types:
- published
workflow_dispatch:
jobs:
docker-build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Set build version
run: |
VERSION_PATTERN='([[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+)(-?rc[[:digit:]]+)?-?([[:digit:]]*)-?[[:alnum:]]*'
echo VERSION=$(git describe --tags > /dev/null 2>&1 && git describe --tags | head -1 | sed -re "s/${VERSION_PATTERN}/\\1.\\3\\2/" | sed -re 's/\.$/.0/') >> $GITHUB_ENV
- name: Build and push main image
uses: docker/build-push-action@v3
with:
push: true
tags: fossology/fossology:latest
context: .
cache-from: type=gha
cache-to: type=gha,mode=max
labels: |
org.opencontainers.image.version=${VERSION}
- name: Build and push runner image
uses: docker/build-push-action@v3
with:
push: true
tags: fossology/fossology:scanner
file: utils/automation/Dockerfile.ci
cache-from: type=gha
cache-to: type=gha,mode=max
labels: |
org.opencontainers.image.version=${VERSION}