Skip to content

Commit 7b7a26d

Browse files
committed
add back bake
1 parent f0924ce commit 7b7a26d

File tree

2 files changed

+52
-29
lines changed

2 files changed

+52
-29
lines changed

.github/workflows/docker-build.yml

Lines changed: 9 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@ name: docker-build
22

33
on:
44
push:
5-
branches:
6-
- main
5+
pull_request:
76

87
jobs:
98
multi-arch-push:
@@ -12,19 +11,9 @@ jobs:
1211
-
1312
name: Checkout
1413
uses: actions/checkout@v4
15-
with:
16-
fetch-depth: 0
1714
-
1815
name: Set up Docker Buildx
1916
uses: docker/setup-buildx-action@v3
20-
-
21-
name: Cache Docker layers
22-
uses: actions/cache@v4
23-
with:
24-
path: /tmp/.buildx-cache
25-
key: ${{ runner.os }}-buildx-${{ github.sha }}
26-
restore-keys: |
27-
${{ runner.os }}-buildx-
2817
-
2918
name: Login to GitHub Registry
3019
uses: docker/login-action@v3
@@ -39,21 +28,12 @@ jobs:
3928
username: erisamoe
4029
password: ${{ secrets.DOCKERHUB_TOKEN }}
4130
-
42-
name: Get Latest Tag
43-
id: previoustag
44-
uses: WyriHaximus/github-action-get-previous-tag@04e8485ecb6487243907e330d522ff60f02283ce # [email protected]
45-
-
46-
name: Build and push
47-
uses: docker/build-push-action@v5
31+
name: Bake image
32+
uses: docker/bake-action@v6
33+
env:
34+
MULTI_PLATFORM: true
4835
with:
49-
context: .
50-
file: ./Dockerfile
51-
platforms: linux/amd64,linux/386,linux/arm64,linux/arm/v7,linux/arm/v6,linux/s390x,linux/ppc64le,linux/riscv64
52-
push: true
53-
tags: |
54-
erisamoe/cloudflared:latest
55-
erisamoe/cloudflared:${{ steps.previoustag.outputs.tag }}
56-
ghcr.io/erisa/cloudflared:latest
57-
ghcr.io/erisa/cloudflared:${{ steps.previoustag.outputs.tag }}
58-
cache-from: type=local,src=/tmp/.buildx-cache
59-
cache-to: type=local,dest=/tmp/.buildx-cache
36+
push: ${{ github.ref == 'refs/heads/main' }}
37+
set: |
38+
*.cache-from=type=gha
39+
*.cache-to=type=gha,mode=max

docker-bake.hcl

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
variable "CLOUDFLARED_VERSION" {
2+
default = "2025.4.2"
3+
}
4+
5+
variable "LATEST" {
6+
default = true
7+
}
8+
9+
variable "MULTI_PLATFORM" {
10+
default = false
11+
}
12+
13+
variable "GOVERSION" {
14+
default = "1.23.9"
15+
}
16+
17+
variable "ALPINEVERSION" {
18+
default = "3.21"
19+
}
20+
21+
target "default" {
22+
args = {
23+
VERSION = CLOUDFLARED_VERSION
24+
GOVERSION = GOVERSION
25+
ALPINEVERSION = ALPINEVERSION
26+
}
27+
platforms = !MULTI_PLATFORM ? null : [
28+
"linux/amd64",
29+
"linux/386",
30+
"linux/arm64",
31+
"linux/arm/v7",
32+
"linux/arm/v6",
33+
"linux/s390x",
34+
"linux/ppc64le",
35+
"linux/riscv64"
36+
]
37+
tags = [
38+
"erisamoe/cloudflared:${CLOUDFLARED_VERSION}",
39+
"ghcr.io/erisa/cloudflared:${CLOUDFLARED_VERSION}",
40+
LATEST ? "erisamoe/cloudflared:latest" : "",
41+
LATEST ? "ghcr.io/erisa/cloudflared:latest" : "",
42+
]
43+
}

0 commit comments

Comments
 (0)