-
Notifications
You must be signed in to change notification settings - Fork 8
77 lines (62 loc) · 1.94 KB
/
build_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
73
74
75
76
77
name: Build latest version Docker images
env:
REGISTRY: ghcr.io
on:
schedule:
- cron: '0 5 1 * *'
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
name: Build & Deploy Docker Images
strategy:
fail-fast: true
matrix:
config:
- {
tag: "rbmi:latest"
}
# Token permissions
permissions:
contents: read
packages: write
# Build steps
steps:
- name: Check out the repo
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
id: buildx
with:
install: true
- name: Log in to the Container registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Cache Docker layers
uses: actions/cache@v3
with:
path: /tmp/.buildx-cache
key: docker-cache-${{ matrix.config.tag }}
- name: debug
run: |
echo push = ${{ github.event_name == 'push' }}
echo tag = ${{ env.REGISTRY }}/${{ github.repository_owner }}/${{ matrix.config.tag }}
- name: Build and push image
uses: docker/build-push-action@v3
with:
context: .
push: true
tags: ${{ env.REGISTRY }}/${{ github.repository_owner }}/${{ matrix.config.tag }}
build-args: |
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new
# Fix bug where docker cache just continiously grows as it doesn't purge older layers
# That are no longer in use
# https://github.com/docker/build-push-action/blob/master/docs/advanced/cache.md#local-cache
- name: Move cache
run: |
rm -rf /tmp/.buildx-cache
mv /tmp/.buildx-cache-new /tmp/.buildx-cache