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

Example bake file for custom docker builds #2140

Closed
alwaysmpe opened this issue Aug 30, 2024 · 4 comments · Fixed by #2141
Closed

Example bake file for custom docker builds #2140

alwaysmpe opened this issue Aug 30, 2024 · 4 comments · Fixed by #2141
Labels
type:Enhancement A proposed enhancement to the docker images

Comments

@alwaysmpe
Copy link
Contributor

alwaysmpe commented Aug 30, 2024

What docker image(s) is this feature applicable to?

docker-stacks-foundation

What change(s) are you proposing?

I'm using these docker stacks built locally with python3.12, out of the box that's quite cumbersome to do. There are args for each dockerfile but these need to be built manually with custom arguments in the correct order.

To simplify this process, I've configured this repo as a submodule, I'm then using a bake file to automate the builds. So in my local repo users can run 2 commands and have a comparable config setup:

docker buildx bake
docker compose up

This use case is explicitly cited by the bake docs

You can Use this feature when you have multiple Dockerfiles that can't be easily merged into one.

How does this affect the user?

Makes using customized builds easier.

Anything else?

For my example use, see the bake file in my repo (the rest of the code is pretty hacked together stuff, I'm using it to teach basics of DSP).

Happy to create a PR but not sure if this would be better as a recipe/example or whether it's something that you'd want as part of your standard build process.

@alwaysmpe alwaysmpe added the type:Enhancement A proposed enhancement to the docker images label Aug 30, 2024
@alwaysmpe
Copy link
Contributor Author

alwaysmpe commented Aug 30, 2024

This would for example help reduce the user friction described in #2139
As discussed in #1557 base images with proprietary licenses are (understandably) avoided, this might also simplify the process for end users to build these types of images themselves if desired.

@mathbunnyru
Copy link
Member

mathbunnyru commented Aug 31, 2024

Thanks for this idea @alwaysmpe,

bake seems to be a nice tool and it's a good idea to have an example in our repo.

Happy to create a PR but not sure if this would be better as a recipe/example or whether it's something that you'd want as part of your standard build process.

I think the new recipe should work fine here.
One implementation detail - please, put the bake file as a separate file in the repo, not inline as part of docs.
We do it for our custom recipes (search for literalinclude):
https://raw.githubusercontent.com/jupyter/docker-stacks/main/docs/using/recipes.md

@mathbunnyru
Copy link
Member

@mj0nez you might be interested in this issue, as it is a nice way to build your own set of images.

@alwaysmpe
Copy link
Contributor Author

alwaysmpe commented Sep 1, 2024

Cool, I'll try to get to it soon. I've been playing/refining further and have worked out I don't need the submodule, bake can build from a git url directly, so even simpler to use. The submodule step was causing some confusion, different git clients each with their own way of handling submodules.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:Enhancement A proposed enhancement to the docker images
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants