-
Notifications
You must be signed in to change notification settings - Fork 0
72 lines (63 loc) · 1.95 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
62
63
64
65
66
67
68
69
70
71
72
name: Publish Docker images
on:
push:
branches: [ master ]
schedule:
- cron: '0 0 * * 0'
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
#version: [latest, 10, 12, 14, 15, 16, 18]
#distro: [ buster, bullseye, debian, alpine ]
version: [latest, 16, 18]
distro: [ alpine ]
env:
repo: "govpf/node"
steps:
- name: Checkout
uses: actions/checkout@v3.5.0
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2.5.0
- name: Login to DockerHub
uses: docker/login-action@v2.1.0
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Check file existence
id: check_files
uses: andstor/file-existence-action@v2
with:
files: ${{ matrix.version }}/${{ matrix.distro }}/Dockerfile
- name: Compute tags
if: steps.check_files.outputs.files_exists == 'true'
env:
repo: ${{ env.repo }}
version: ${{ matrix.version }}
distro: ${{ matrix.distro }}
run: |
TAGS="${repo}:${version}-${distro}"
if [[ $distro == 'bullseye' ]]; then
TAGS+=",${repo}:${version}"
fi
echo 'docker_tags<<EOF' >> $GITHUB_ENV
echo "$TAGS" >> $GITHUB_ENV
echo 'EOF' >> $GITHUB_ENV
- name: Build
if: steps.check_files.outputs.files_exists == 'true'
uses: docker/build-push-action@v4.0.0
with:
context: .
file: ./${{ matrix.version }}/${{ matrix.distro }}/Dockerfile
platforms: linux/amd64
pull: true
push: true
tags: ${{ env.docker_tags }}
- name: Update repo description
if: steps.check_files.outputs.files_exists == 'true'
uses: peter-evans/dockerhub-description@v3.3.0
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
repository: "${{ env.repo }}"