-
Notifications
You must be signed in to change notification settings - Fork 0
61 lines (53 loc) · 1.49 KB
/
docker-image.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
name: Publish Docker images
on:
push:
branches: [ master ]
schedule:
- cron: '0 0 * * 0'
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
version: [3.2, 4.6]
jdk: [8, 11]
env:
repo: "govpf/sonar-scanner"
steps:
- name: Checkout
uses: actions/[email protected]
- name: Set up Docker Buildx
uses: docker/[email protected]
- name: Login to DockerHub
uses: docker/[email protected]
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Compute tags
env:
repo: ${{ env.repo }}
version: ${{ matrix.version }}
jdk: ${{ matrix.jdk }}
run: |
TAGS="${repo}:${version}-jdk-${jdk}"
if [[ $jdk == '8' ]]; then
TAGS+=",${repo}:${version}"
fi
echo 'docker_tags<<EOF' >> $GITHUB_ENV
echo "$TAGS" >> $GITHUB_ENV
echo 'EOF' >> $GITHUB_ENV
- name: Build and push
uses: docker/[email protected]
with:
context: .
file: ./${{ matrix.version }}/jdk-${{ matrix.jdk }}/Dockerfile
platforms: linux/amd64
pull: true
push: true
tags: ${{ env.docker_tags }}
- name: Update repo description
uses: peter-evans/[email protected]
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
repository: "${{ env.repo }}"