-
Notifications
You must be signed in to change notification settings - Fork 0
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 Ubuntu RISCV64 Docker base images #1
Conversation
fe83783
to
79314b2
Compare
Fix up for name collision
79314b2
to
af2f43e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was just going through some WIP to see if anything was blocked, and thought a review here might help this one along :)
let base ?arch distro = | ||
let repo = if arch = None then Conf.public_repo else Conf.staging_repo in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The default argument can be shortened to
let base ?arch distro = | |
let repo = if arch = None then Conf.public_repo else Conf.staging_repo in | |
let base ?(arch=Conf.public_repo) distro = |
if distro = `Debian `Stable then "debian" | ||
else Dockerfile_opam.Distro.tag_of_distro distro |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why can't we just use Dockerfile_opam.Distro.tag_of_distro
without the conditional? Or, if we need just the distro name, could we use Dockerfile_opam.Distro.base_distro_tag
?
@@ -377,6 +408,7 @@ module Make (OCurrent : S.OCURRENT) = struct | |||
let multiarch, pipelines = List.fold_left_map distro_pipeline Switch_map.empty distro_versions in | |||
let pushes = | |||
Switch_map.fold (fun switch images pushes -> | |||
let distro_label = String.split_on_char '-' distro_label |> String.concat "-all-" in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Two questions here:
- Why add this new
-all-
infix element? - It looks looks like windows labels can have multiple
-
s, which would lead to wrong logic here, iiuc. I'm basing this on looking at https://github.com/shonfeder/ocaml-dockerfile/blob/b86eda9800d25f62a632b90f13ef44d9775a76e8/src-opam/distro.ml#L712-L719
let build_distro_base ocluster arch distro = | ||
let dist, release = Distro.base_distro_tag distro in | ||
Current.component "%s %s" dist release |> | ||
let> distro = Current.return distro in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Iiuc, this is a no-op, so can be removed
let> distro = Current.return distro in |
let build_distro_base ocluster arch distro = | ||
let dist, release = Distro.base_distro_tag distro in | ||
Current.component "%s %s" dist release |> | ||
let> distro = Current.return distro in | ||
let dockerfile = | ||
let open Dockerfile in | ||
`Contents ( | ||
string_of_t ( | ||
from "ubuntu:jammy-20220801 AS base" @@ | ||
workdir "/base" @@ | ||
run "apt update && apt install -y debootstrap" @@ | ||
run "ln -s gutsy /usr/share/debootstrap/scripts/noble" @@ | ||
run "debootstrap %s /base" release @@ | ||
from "scratch" @@ | ||
copy ~from:"base" ~src:["/base"] ~dst:"/" () @@ | ||
cmd "/bin/bash")) in | ||
let options = { Cluster_api.Docker.Spec.defaults with | ||
squash = squash distro; | ||
buildkit = buildkit distro } in | ||
let cache_hint = "ubuntu-" ^ release in | ||
OCluster.Raw.build_and_push ocluster dockerfile | ||
~src:[] | ||
~cache_hint | ||
~push_target:(Cluster_api.Docker.Image_id.of_string Tag.(base ~arch distro) |> or_die) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ubuntu
is hard coded throughout this function and we only call it for a single distro and architecture, so I'm not sure it makes sense for it to try to be general in other places, i.e., by using the newly defined Tag.base
function and appearing as abstraction over arch
and distro
. Maybe we only really need the distro version at this point?
No description provided.