-
Notifications
You must be signed in to change notification settings - Fork 33
Expand file tree
/
Copy pathconfig.clj
More file actions
159 lines (131 loc) · 5.78 KB
/
config.clj
File metadata and controls
159 lines (131 loc) · 5.78 KB
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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
(ns docker-clojure.config
(:require [clojure.spec.alpha :as s]
[clojure.spec.gen.alpha :as gen]
[clojure.string :as str]
[com.gfredericks.test.chuck.generators :as gen']
[docker-clojure.core :as-alias core]))
(s/def ::non-blank-string
(s/and string? #(not (str/blank? %))))
(s/def ::jdk-version
(s/and pos-int? #(<= 8 %)))
(s/def ::jdk-versions (s/coll-of ::jdk-version :distinct true :into #{}))
(s/def ::base-image ::non-blank-string)
(s/def ::base-images (s/coll-of ::base-image :distinct true :into #{}))
(def docker-image-name-re (re-pattern "[-\\w]+(?::[-\\w.]+)?"))
(s/def ::docker-image-name
(s/with-gen
(s/and ::non-blank-string
#(re-matches docker-image-name-re %))
#(gen'/string-from-regex docker-image-name-re)))
(def docker-tag-re (re-pattern "[-\\w.]+"))
(s/def ::docker-tag
(s/with-gen
(s/and ::non-blank-string
#(re-matches docker-tag-re %))
#(gen'/string-from-regex docker-tag-re)))
(s/def ::base-image-tag ::docker-image-name)
(def distro-component-re (re-pattern "[-_A-Za-z][-\\w.]+"))
(s/def ::distro
(s/with-gen
(s/and qualified-keyword?
#(->> %
((juxt namespace name))
((fn [elements]
(every? (fn [e] (re-matches distro-component-re e))
elements)))))
#(gen/fmap (fn [[namespace local]] (keyword namespace local))
(gen/vector (gen'/string-from-regex distro-component-re) 2))))
(s/def ::distros (s/coll-of ::distro :distinct true :into #{}))
(s/def ::specific-build-tool #{"lein" "tools-deps"})
(s/def ::build-tool (s/or ::specific-tool ::specific-build-tool
::all-tools #{::core/all}))
(s/def ::specific-build-tool-version
(s/with-gen
(s/and ::non-blank-string
#(re-matches #"(?:\d+\.)+\d+" %))
#(gen/fmap (fn [nums] (str/join "." nums))
(gen/vector (gen/int) 2 4))))
(s/def ::build-tool-version
(s/nilable ::specific-build-tool-version))
(s/def ::build-tool-versions
(s/map-of ::specific-build-tool ::specific-build-tool-version))
(s/def ::maintainers
(s/coll-of ::non-blank-string :distinct true :into #{}))
(s/def ::maintainer ::non-blank-string)
(s/def ::architecture ::non-blank-string)
(s/def ::architectures (s/coll-of ::architecture :distinct true :into #{}))
(def git-repo "https://github.com/Quantisan/docker-clojure.git")
(def jdk-versions #{8 11 17 21 25})
(def base-images
"Map of JDK version to base image name(s) with :default as a fallback"
{8 ["eclipse-temurin" "debian"]
11 ["eclipse-temurin" "debian"]
17 ["eclipse-temurin" "debian"]
:default ["debian" "eclipse-temurin"]})
;; The default JDK version to use for tags that don't specify one; usually the latest LTS release
(def default-jdk-version 25)
(def distros
"Map of base image name to set of distro tags to use, namespaced by Linux
distro type. :default key is a fallback for base images not o/w specified."
{:default #{:alpine/alpine :ubuntu/jammy :ubuntu/noble}
"debian" #{:debian-slim/bookworm-slim :debian/bookworm
:debian-slim/bullseye-slim :debian/bullseye
:debian-slim/trixie-slim :debian/trixie}})
(def architectures
#{"amd64" "arm64v8" "ppc64le" "riscv64" "s390x"})
(def default-distros
"The default distro to use for tags that don't specify one, keyed by jdk-version.
:default is a fallback for jdk versions not o/w specified."
{8 :ubuntu/noble
11 :ubuntu/noble
17 :ubuntu/noble
:default :debian/bookworm})
(def build-tools
{"lein" "2.12.0"
"tools-deps" "1.12.4.1612"})
(def default-build-tool "tools-deps")
(def installer-hashes
{"lein" {"2.11.2" "28a1a62668c5f427b413a8677e376affaa995f023b1fcd06e2d4c98ac1df5f3e"
"2.12.0" "12a9c5e3a2471619ca3d64a7462f920fdf713ae8959eb4fcd6257c23332b5aa4"}
"tools-deps" {"1.12.4.1607" "bdd7f655825144cbe9055569bfc78b01c44dc2b7156802c817608db9229c8ab5"
"1.12.4.1612" "21d16fbce3e546c4f0163c78aba0eb0293993c7fa1aba77d089fdbfa445e38a2"}})
(def exclusions ; don't build these for whatever reason(s)
#{;; No more jammy builds for JDK 23+
{:jdk-version #(>= % 23)
:distro :ubuntu/jammy}
;; No upstream ARM alpine images available before JDK 21
{:jdk-version #(< % 21)
:architecture "arm64v8"
:distro :alpine/alpine}
;; Only build amd64 & arm64 architectures for alpine
{:architecture #(not (#{"amd64" "arm64v8"} %))
:distro :alpine/alpine}
;; Alpine w/ Java 8 stopped building correctly and not worth the time to fix
{:jdk-version 8
:distro :alpine/alpine}
;; ppc64le needs Debian Bookworm or newer
{:architecture "ppc64le"
:distro #(and (-> % namespace (str/starts-with? "debian"))
(-> % name (str/starts-with? "bullseye")))}
;; riscv64 is only supported for Java 17+
{:architecture "riscv64"
:jdk-version #(< % 17)}
;; riscv64 isn't supported on Ubuntu Jammy
{:architecture "riscv64"
:distro :ubuntu/jammy}
;; riscv64 needs Debian Trixie or newer
{:architecture "riscv64"
:distro #(and (-> % namespace (str/starts-with? "debian"))
(let [n (name %)]
(or (str/starts-with? n "bullseye")
(str/starts-with? n "bookworm"))))}
;; s390x is only supported for Java 11+
{:architecture "s390x"
:jdk-version #(< % 11)}
;; s390x needs Debian Bookworm or newer
{:architecture "s390x"
:distro #(and (-> % namespace (str/starts-with? "debian"))
(-> % name (str/starts-with? "bullseye")))}})
(def maintainers
["Paul Lam <paul@quantisan.com> (@Quantisan)"
"Wes Morgan <wes@wesmorgan.me> (@cap10morgan)"])