-
-
Notifications
You must be signed in to change notification settings - Fork 29
72 lines (62 loc) · 2.08 KB
/
docker.yaml
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: Docker
on:
push:
branches: [ "release/v2.5" ]
tags: [ "v2.5.*" ]
jobs:
build:
strategy:
matrix:
os: [ ubuntu-20.04 ]
target: [ kupo ]
runs-on: ${{ matrix.os }}
steps:
- name: 📥 Checkout repository
uses: actions/checkout@v3
with:
submodules: true
- name: 🧰 Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: 🧐 hadolint
uses: hadolint/[email protected]
with:
dockerfile: "./Dockerfile"
failure-threshold: warning
ignore: DL3059, SC2086, DL3029
- name: 🐳 Login to DockerHub
if: ${{ github.event_name == 'push' }}
uses: docker/[email protected]
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_ACCESS_TOKEN }}
- name: 📝 Base Variables
id: base-variables
run: |
echo "image=cardanosolutions/${{ matrix.target }}" >> $GITHUB_OUTPUT
- name: 📝 Tag Variables
if: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags') }}
id: tag-variables
run: |
echo "tag=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_OUTPUT
- name: 🔨 Build and push (latest)
if: ${{ github.event_name == 'push' }}
uses: docker/build-push-action@v3
with:
context: .
push: true
platforms: linux/amd64
tags: ${{ steps.base-variables.outputs.image }}:latest
target: ${{ matrix.target }}
cache-from: type=registry,ref=${{ steps.base-variables.outputs.image }}:latest
cache-to: type=inline
- name: 🏷️ Build and push (tag)
if: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags') }}
uses: docker/build-push-action@v3
with:
context: .
push: true
platforms: linux/amd64
tags: ${{ steps.base-variables.outputs.image }}:${{ steps.tag-variables.outputs.tag }}
target: ${{ matrix.target }}
cache-from: type=registry,ref=${{ steps.base-variables.outputs.image }}:latest
cache-to: type=inline