-
Notifications
You must be signed in to change notification settings - Fork 3
60 lines (51 loc) · 1.57 KB
/
build-commit.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
name: Build Commit
on:
push:
branches:
- main
permissions:
packages: write
env:
IMAGE_OWNER: "deploykf"
IMAGE_TITLE: "dashboard"
IMAGE_FOLDER: "dashboard"
IMAGE_PLATFORMS: |-
linux/amd64
linux/arm64
jobs:
build_and_push_image:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install QEMU
uses: docker/setup-qemu-action@v2
- name: Install Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Generate Image Tags/Labels
id: meta
uses: docker/metadata-action@v4
with:
images: |
ghcr.io/${{ env.IMAGE_OWNER }}/ci/${{ env.IMAGE_TITLE }}
flavor: |
latest=false
tags: |
type=sha,priority=200,prefix=sha-,format=short
type=sha,priority=100,prefix=sha-,format=long
- name: Build and Push Image
uses: docker/build-push-action@v4
with:
context: ./${{ env.IMAGE_FOLDER }}
push: true
platforms: ${{ env.IMAGE_PLATFORMS }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=registry,ref=ghcr.io/${{ env.IMAGE_OWNER }}/ci/${{ env.IMAGE_TITLE }}
cache-to: type=registry,ref=ghcr.io/${{ env.IMAGE_OWNER }}/ci/${{ env.IMAGE_TITLE }},mode=max