Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build using custom/local Docker registry #65

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/conf.ml
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
(* Use None for the main Docker Registry.
Do NOT set this to Some "docker.io" *)
let registry = None

(* For staging arch-specific builds before creating the manifest. *)
let staging_repo = "ocurrent/opam-staging"

Expand All @@ -21,7 +25,8 @@ let auth =
close_in ch;
Some ("ocurrent", password)
) else (
Fmt.pr "Password file %S not found; images will not be pushed to hub@." password_path;
if registry = None then
Fmt.pr "Password file %S not found; images will not be pushed to hub@." password_path;
None
)

Expand Down
11 changes: 8 additions & 3 deletions src/tag.ml
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
let public_repo, staging_repo =
match Conf.registry with
| None -> Conf.public_repo, Conf.staging_repo
| Some registry -> registry ^ "/" ^ Conf.public_repo, registry ^ "/" ^ Conf.staging_repo

let pp_arch f = function
| None -> ()
| Some arch -> Fmt.pf f "-%s" (Ocaml_version.string_of_arch arch)
Expand All @@ -10,7 +15,7 @@ let tag_of_compiler switch =
)

let v ?arch ?switch distro =
let repo = if arch = None then Conf.public_repo else Conf.staging_repo in
let repo = if arch = None then public_repo else staging_repo in
let distro = Dockerfile_distro.tag_of_distro distro in
let switch =
match switch with
Expand All @@ -24,7 +29,7 @@ let v_alias alias =
if alias = `Debian `Stable then "debian"
else Dockerfile_distro.tag_of_distro alias
in
Fmt.strf "%s:%s" Conf.public_repo alias
Fmt.strf "%s:%s" public_repo alias

let latest =
Fmt.strf "%s:latest" Conf.public_repo
Fmt.strf "%s:latest" public_repo