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

Remove opam-repository from the dockerfiles created by dockerfile-opam #87

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
16 changes: 6 additions & 10 deletions src-opam/dockerfile_opam.ml
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ let windows_opam2 ?win10_revision ?winget ?(labels=[]) ?arch distro () =
@@ Windows.Cygwin.Git.init ()
@@ Windows.cleanup ()

let gen_opam2_distro ?win10_revision ?winget ?(clone_opam_repo=true) ?arch ?labels ~opam_hashes d =
let gen_opam2_distro ?win10_revision ?winget ?arch ?labels ~opam_hashes d =
let fn = match D.package_manager d with
| `Apk -> apk_opam2 ?labels ?arch ~opam_hashes d ()
| `Apt -> apt_opam2 ?labels ?arch ~opam_hashes d ()
Expand All @@ -337,13 +337,9 @@ let gen_opam2_distro ?win10_revision ?winget ?(clone_opam_repo=true) ?arch ?labe
| `Cygwin -> cygwin_opam2 ?win10_revision ?labels ?arch ~opam_hashes d ()
| `Windows -> windows_opam2 ?win10_revision ?winget ?labels ?arch d ()
in
let clone = if clone_opam_repo then
let url = Dockerfile_distro.(os_family_of_distro d |> opam_repository) in
run "git clone %S /home/opam/opam-repository" url
else empty in
let pers = match personality ?arch d with
| None -> empty | Some pers -> entrypoint_exec [pers] in
(D.tag_of_distro d, fn @@ clone @@ pers)
(D.tag_of_distro d, fn @@ pers)

let create_switch ~arch distro t =
let create_switch switch pkg = run "opam switch create %s %s" (OV.to_string switch) pkg in
Expand Down Expand Up @@ -375,9 +371,9 @@ let all_ocaml_compilers hub_id arch distro =
| `Windows | `Cygwin -> empty
in
header ~arch ~tag:(Printf.sprintf "%s-opam" distro_tag) ~img:hub_id distro
@@ workdir "/home/opam/opam-repository" @@ run "git pull origin master"
@@ sandbox
@@ run "opam init -k git -a /home/opam/opam-repository --bare%s"
@@ run "opam init -k git -a %s --bare%s"
(Dockerfile_distro.opam_repository (Dockerfile_distro.os_family_of_distro distro))
(if os_family = `Windows then " --disable-sandboxing" else "")
@@ compilers
@@ run "opam switch %s" (OV.(to_string (with_patch OV.Releases.latest None)))
Expand Down Expand Up @@ -416,9 +412,9 @@ let separate_ocaml_compilers hub_id arch distro =
| `Linux -> run "opam-sandbox-disable"
| `Windows | `Cygwin -> empty in
header ~arch ~tag:(Printf.sprintf "%s-opam" distro_tag) ~img:hub_id distro
@@ workdir "/home/opam/opam-repository"
@@ sandbox
@@ run "opam init -k git -a /home/opam/opam-repository --bare%s"
@@ run "opam init -k git -a %s --bare%s"
(Dockerfile_distro.opam_repository (Dockerfile_distro.os_family_of_distro distro))
(if os_family = `Windows then "--disable-sandboxing" else "")
@@ add_remote
@@ variants
Expand Down
3 changes: 0 additions & 3 deletions src-opam/dockerfile_opam.mli
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ type opam_hashes = {
val gen_opam2_distro :
?win10_revision:Dockerfile_distro.win10_lcu ->
?winget:string ->
?clone_opam_repo:bool ->
?arch:Ocaml_version.arch ->
?labels:(string * string) list ->
opam_hashes:opam_hashes ->
Expand All @@ -58,8 +57,6 @@ val gen_opam2_distro :
for Linux distribution [d] with opam 2.0, opam 2.1, opam 2.2 and opam master,
per hash given in parameter.
@return a tuple of the Docker tag and the Dockerfile.
If [clone_opam_repo] is true (the default) then the Dockerfile will also git
clone the official opam-repository into [/home/opam/opam-repository].
If [arch] is not specified, it defaults to the base image that is assumed
to be multiarch (the main exception to this is i386, which requires different
base images from amd64).
Expand Down