-
Notifications
You must be signed in to change notification settings - Fork 183
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
Switch from docker-compose build
to docker buildx bake
#220
Conversation
and add a docker-bake.override.json
This change also removes the hard-coding of image names in Or, we can merge them into a single file and define the target with dependencies in |
I've thought about it a lot, and since the number of images ( {
"r_version": [
"4.0.2",
"4.0.3",
"4.0.4"
],
"group": [
"default"
],
"include": [
{
"r_version": "4.0.3",
"group": "cuda11"
},
{
"r_version": "4.0.4",
"group": "cuda11"
}
]
} I will work on that after this PR is merged and I would like to integrate |
Related to rocker-org/rocker-versioned#211 rocker-org/rocker#349 rocker-org/rocker#398
Completely rewrite the
Makefile
to make it easier to build container images withdocker buildx bake
, and we will also use theMakefile
for building on GitHub Actions.The
jq
command is required and must be set to"experimental": "enabled"
in~/.docker/config.json
to use buildx.The build with the
buildx bake
command was once considered in #130, but the method using the existingdocker-compose.yml
considered in #130 does not do the right build.This is because the current
buildx bake
command (v0.6) builds all targets in parallel without considering the dependencies between the targets. (docker/buildx#141, docker/buildx#447)For example, since
rocker/r-ver
androcker/rstudio
start building at the same time, newrocker/rstudio
will be based on the already publishedrocker/r-ver
instead of the newrocker/r-ver
.Therefore, in this PR, the targets of
docker-bake.json
are taken out in order from the top by thejq
command and build and push one by one.This method does not take advantage of parallel builds, but it has the following improvements over the current build method.
Makefile
. This will make it unnecessary to edit theMakefile
when a new version is released. (It is more advantageous to specifydocker-bake.json
as a matrix of GitHub Actions for parallelization, so I do not define a job that builds against all definition files in the directory as before.)org.opencontainers.image.revision
in the images. This will also show up in the reports published on the wiki, making it easier to compare the contents of the images' source.rocker/r-ver:latest
,rocker/r-ver:4
,rocker/r-ver:4.1
are automatically set in the stack files bymake-stacks.R
(Update for automated multi-tagging and reducing the number of stack files #214) and can be pushed without any additional steps.We can also do multi-architecture builds in the future.
As mentioned in the command example in the
Makefile
, the following command will show the definitions for buildingrocker/r-ver:4.1.1
on amd64 and arm64 multi-arch build.(After setting up the builder instance and disabling the
--print
option, will cause the build to take place, but please note that it will take several hours.)If you want to check that the build actually takes place, you can build
core-latest-daily
as shown below for a quick check.If we inspect the built image, we will see that the commit hash has been recorded.
@cboettig @noamross How about it? I'm new to Makefiles, so I'd appreciate it if you could point out the bad writing.
ToDo
core.yml
to usemake
core.yml
.