-
Notifications
You must be signed in to change notification settings - Fork 0
77 lines (73 loc) · 1.85 KB
/
ci.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
73
74
75
76
77
name: Container Build
on:
push:
paths:
- 'context/**'
- '.github/workflows/ci.yml'
branches:
- '**'
tags:
- '*.*.*'
env:
DOCKER_REPO: tomeichlersmith/hps-env
jobs:
build:
runs-on: ubuntu-latest
defaults:
run:
shell: bash
steps:
-
name: Setup QEMU
uses: docker/setup-qemu-action@v3
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
-
name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
-
name: Get Build Context
uses: actions/checkout@v4
with:
submodules: 'recursive'
fetch-depth: 0
-
name: Cache Docker Layers on GitHub
uses: actions/cache@v4
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-${{ hashFiles('context/Dockerfile') }}
restore-keys: |
${{ runner.os }}-${{ hashFiles('context/Dockerfile') }}
${{ runner.os }}
-
name: Determine Image Tags
id: generate_tag
uses: docker/metadata-action@v5
with:
images: ${{ env.DOCKER_REPO }}
-
name: Determine Image labels
id: generate_labels
run: |
{
echo 'labels<<ENDOFLABELS'
echo "${{ steps.generate_tag.outputs.labels }}"
./.github/submodule-labels
echo 'ENDOFLABELS'
} >> $GITHUB_OUTPUT
-
name: Build the Image
uses: docker/build-push-action@v6
with:
context: context
file: context/Dockerfile
push: true
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
tags: ${{ steps.generate_tag.outputs.tags }}
labels: ${{ steps.generate_labels.outputs.labels }}