Skip to content

Commit a60803b

Browse files
Merge remote-tracking branch 'origin/main' into main
2 parents 794677c + f73ff8a commit a60803b

File tree

1 file changed

+76
-0
lines changed

1 file changed

+76
-0
lines changed

.github/workflows/docker-build.yml

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
name: branch build & push
2+
3+
on:
4+
#schedule:
5+
# - cron: '50 15 * * *' #Change this to when you want automatic builds
6+
push:
7+
paths-ignore:
8+
- 'README.md'
9+
tags: [ 'v*.*.*' ]
10+
workflow_dispatch:
11+
12+
env:
13+
REGISTRY: docker.io
14+
IMAGE_NAME: ${{ secrets.DOCKERHUB_IMAGE_NAME }}
15+
16+
jobs:
17+
build:
18+
19+
runs-on: ubuntu-latest
20+
permissions:
21+
contents: read
22+
packages: write
23+
# This is used to complete the identity challenge
24+
# with sigstore/fulcio when running outside of PRs.
25+
id-token: write
26+
27+
steps:
28+
- name: Checkout repository
29+
uses: actions/checkout@v2
30+
31+
- name: Set up QEMU
32+
uses: docker/setup-qemu-action@v1
33+
34+
- name: Setup Docker buildx
35+
uses: docker/setup-buildx-action@v1
36+
37+
- name: Cache Docker layers
38+
uses: actions/cache@v2
39+
with:
40+
path: /tmp/.buildx-cache
41+
key: ${{ runner.os }}-buildx-${{ github.sha }}
42+
restore-keys: |
43+
${{ runner.os }}-buildx-
44+
45+
- name: Login to Docker Hub
46+
uses: docker/login-action@v1
47+
with:
48+
username: ${{ secrets.DOCKERHUB_USERNAME }}
49+
password: ${{ secrets.DOCKERHUB_TOKEN }}
50+
51+
- name: Production Build and push
52+
if: contains(github.ref, "main")
53+
uses: docker/build-push-action@v2
54+
with:
55+
context: .
56+
push: true
57+
tags: ${{ secrets.DOCKERHUB_USERNAME }}/${{ secrets.DOCKERHUB_IMAGE_NAME }}:latest
58+
platforms: linux/amd64,linux/arm/v7,linux/arm64/v8
59+
cache-from: type=local,src=/tmp/.buildx-cache
60+
cache-to: type=local,dest=/tmp/.buildx-cache-new
61+
62+
- name: Development Build and push
63+
if: contains(github.ref, "develop")
64+
uses: docker/build-push-action@v2
65+
with:
66+
context: .
67+
push: true
68+
tags: ${{ secrets.DOCKERHUB_USERNAME }}/${{ secrets.DOCKERHUB_IMAGE_NAME }}:develop
69+
platforms: linux/amd64,linux/arm/v7,linux/arm64/v8
70+
cache-from: type=local,src=/tmp/.buildx-cache
71+
cache-to: type=local,dest=/tmp/.buildx-cache-new
72+
73+
- name: Move cache
74+
run: |
75+
rm -rf /tmp/.buildx-cache
76+
mv /tmp/.buildx-cache-new /tmp/.buildx-cache

0 commit comments

Comments
 (0)