Skip to content

Commit 611f1a1

Browse files
committed
Add support for custom Docker registries
Allows the entire process to run without needing to push to Docker hub (which allows the process to run without needing any real secrets)
1 parent cbe6a68 commit 611f1a1

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

src/conf.ml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
(* Use None for the main Docker Registry.
2+
Do NOT set this to Some "docker.io" *)
3+
let registry = Some "localhost:5000"
4+
15
(* For staging arch-specific builds before creating the manifest. *)
26
let staging_repo = "ocurrent/opam-staging"
37

@@ -21,7 +25,8 @@ let auth =
2125
close_in ch;
2226
Some ("ocurrent", password)
2327
) else (
24-
Fmt.pr "Password file %S not found; images will not be pushed to hub@." password_path;
28+
if registry = None then
29+
Fmt.pr "Password file %S not found; images will not be pushed to hub@." password_path;
2530
None
2631
)
2732

src/tag.ml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
let public_repo, staging_repo =
2+
match Conf.registry with
3+
| None -> Conf.public_repo, Conf.staging_repo
4+
| Some registry -> registry ^ "/" ^ Conf.public_repo, registry ^ "/" ^ Conf.staging_repo
5+
16
let pp_arch f = function
27
| None -> ()
38
| Some arch -> Fmt.pf f "-%s" (Ocaml_version.string_of_arch arch)
@@ -10,7 +15,7 @@ let tag_of_compiler switch =
1015
)
1116

1217
let v ?arch ?switch distro =
13-
let repo = if arch = None then Conf.public_repo else Conf.staging_repo in
18+
let repo = if arch = None then public_repo else staging_repo in
1419
let distro = Dockerfile_distro.tag_of_distro distro in
1520
let switch =
1621
match switch with
@@ -24,7 +29,7 @@ let v_alias alias =
2429
if alias = `Debian `Stable then "debian"
2530
else Dockerfile_distro.tag_of_distro alias
2631
in
27-
Fmt.strf "%s:%s" Conf.public_repo alias
32+
Fmt.strf "%s:%s" public_repo alias
2833

2934
let latest =
30-
Fmt.strf "%s:latest" Conf.public_repo
35+
Fmt.strf "%s:latest" public_repo

0 commit comments

Comments
 (0)