-
Notifications
You must be signed in to change notification settings - Fork 36
64 lines (62 loc) · 2.19 KB
/
update-image-on-push.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
name: "Update image when Dockerfile is changed"
on:
push:
branches:
- master
workflow_dispatch:
jobs:
rebuild-container:
name: "Rebuild Container with the latest base image"
runs-on: ubuntu-latest
steps:
-
name: Prepare outputs
id: prep
run: |
echo "::set-output name=created::$(date -u +'%Y-%m-%dT%H:%M:%SZ')"
-
name: Set up QEMU
uses: docker/[email protected]
with:
platforms: linux/arm64
-
name: Set up Docker Buildx
uses: docker/[email protected]
-
name: Login to GitHub Container Registry
uses: docker/[email protected]
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
-
name: Login to DockerHub
uses: docker/[email protected]
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
-
name: Checkout repository
uses: actions/checkout@v4
-
name: Get short SHA
id: get_short_sha
run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
-
name: Build and push to Docker Hub and GitHub Packages Docker Registry
uses: docker/[email protected]
id: docker_build_push
with:
push: true
platforms: linux/amd64,linux/arm64
tags: |
ghcr.io/${{ github.repository_owner }}/public-pool-ui:latest
ghcr.io/${{ github.repository_owner }}/public-pool-ui:${{ steps.get_short_sha.outputs.sha_short }}
${{ secrets.DOCKER_USERNAME }}/public-pool-ui:latest
${{ secrets.DOCKER_USERNAME }}/public-pool-ui:${{ steps.get_short_sha.outputs.sha_short }}
labels: |
org.opencontainers.image.source=${{ github.event.repository.html_url }}
org.opencontainers.image.created=${{ steps.prep.outputs.created }}
org.opencontainers.image.revision=${{ github.sha }}
cache-from: type=registry,ref=${{ secrets.DOCKER_USERNAME }}/public-pool-ui:latest
cache-to: type=inline