forked from Islandora-Devops/isle-imagemagick
-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-bake.hcl
93 lines (79 loc) · 2.31 KB
/
docker-bake.hcl
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
variable "SOURCE_DATE_EPOCH" {
default = "0"
}
variable "REPOSITORY" {
default = "islandora"
}
variable "TAG" {
# "local" is to distinguish remote images from those produced locally.
default = "local"
}
function "tags" {
params = [image, arch]
result = ["${REPOSITORY}/${image}:${TAG}-${arch}"]
}
function "cacheFrom" {
params = [image, arch]
result = ["type=registry,ref=${REPOSITORY}/cache:${image}-main-${arch}", "type=registry,ref=${REPOSITORY}/cache:${image}-${TAG}-${arch}"]
}
function "cacheTo" {
params = [image, arch]
result = ["type=registry,oci-mediatypes=true,mode=max,compression=estargz,compression-level=5,ref=${REPOSITORY}/cache:${image}-${TAG}-${arch}"]
}
# No default target is specified.
group "amd64" {
targets = [
"imagemagick-amd64",
]
}
group "arm64" {
targets = [
"imagemagick-arm64",
]
}
# CI should build both and push to the remote cache.
group "ci" {
targets = [
"imagemagick-amd64-ci",
"imagemagick-arm64-ci",
]
}
target "common" {
args = {
# Required for reproduciable builds.
# Requires Buildkit 0.11+
# See: https://reproducible-builds.org/docs/source-date-epoch/
SOURCE_DATE_EPOCH = "${SOURCE_DATE_EPOCH}",
}
}
target "imagemagick-common" {
inherits = ["common"]
context = "imagemagick"
contexts = {
# The digest (sha256 hash) is not platform specific but the digest for the manifest of all platforms.
# It will be the digest printed when you do: docker pull alpine:3.17.1
# Not the one displayed on DockerHub.
# N.B. This should match the value used in <https://github.com/Islandora-Devops/isle-buildkit>
alpine = "docker-image://alpine:3.18.4@sha256:eece025e432126ce23f223450a0326fbebde39cdf496a85d8c016293fc851978"
}
}
target "imagemagick-amd64" {
inherits = ["imagemagick-common"]
tags = tags("imagemagick", "amd64")
cache-from = cacheFrom("imagemagick", "amd64")
platforms = ["linux/amd64"]
}
target "imagemagick-amd64-ci" {
inherits = ["imagemagick-amd64"]
cache-to = cacheTo("imagemagick", "amd64")
}
target "imagemagick-arm64" {
inherits = ["imagemagick-common"]
tags = tags("imagemagick", "arm64")
cache-from = cacheFrom("imagemagick", "arm64")
platforms = ["linux/arm64"]
}
target "imagemagick-arm64-ci" {
inherits = ["imagemagick-arm64"]
cache-to = cacheTo("imagemagick", "arm64")
}