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

✨ Create Dockerfile from Dagger #7357

Open
levlaz opened this issue May 10, 2024 · 7 comments
Open

✨ Create Dockerfile from Dagger #7357

levlaz opened this issue May 10, 2024 · 7 comments

Comments

@levlaz
Copy link
Contributor

levlaz commented May 10, 2024

What are you trying to do?

Dagger is really good at reading and executing Dockerfiles, but it would be really cool if you could generate a Dockerfile from Dagger as well.

Why is this important to you?

A few users have mentioned that rewriting their Dockerfile in Dagger (which is a good thing) has some downstream consequences. Most critically it breaks existing docker-compose setups.

How are you currently working around this?

No great workaround.

@wingyplus
Copy link
Contributor

wingyplus commented May 11, 2024

I remember i wrote it somewhere on my machine.😃

But some instructions are not supported by Dagger.

@levlaz
Copy link
Contributor Author

levlaz commented May 11, 2024

I remember i wrote it somewhere on my machine.😃

What do you mean by this? :)

@wingyplus
Copy link
Contributor

wingyplus commented May 11, 2024

I remember i wrote it somewhere on my machine.😃

What do you mean by this? :)

Sorry. I mean I writing a tool like this. But it’s translate from Dockerfile to Dagger. I think we might use graphql parser to translate back somehow.

@sagikazarmark
Copy link
Contributor

A Dockerfile is often still necessary in certain cases, so this would be really cool.

@jedevc
Copy link
Member

jedevc commented May 13, 2024

I'm not sure how feasible this is. This would only really be possible for the most basic of dagger pipelines, but it's kind of unclear how this might work with modules/etc.

If we did decide to do this, the first step would be to remove all of our custom low-level buildkit parts, and either upstream these, or work out how to do without them. We have quite a lot of these, which allow us to do things that the buildkit runtime wouldn't normally let us do (custom sources, our own local directory loading, session manipulation to get isolation, etc).

Doing the reverse seems pretty fun though, there's a dockerfile parser, we could fairly easily write little translators for those into dagger pipelines without too much fuss I think (maybe a fun hackathon project there) - maybe inspired by @wingyplus if there's source code available 🎉

@levlaz
Copy link
Contributor Author

levlaz commented May 13, 2024 via email

@wingyplus
Copy link
Contributor

I'm not sure how feasible this is. This would only really be possible for the most basic of dagger pipelines, but it's kind of unclear how this might work with modules/etc.

If we did decide to do this, the first step would be to remove all of our custom low-level buildkit parts, and either upstream these, or work out how to do without them. We have quite a lot of these, which allow us to do things that the buildkit runtime wouldn't normally let us do (custom sources, our own local directory loading, session manipulation to get isolation, etc).

Doing the reverse seems pretty fun though, there's a dockerfile parser, we could fairly easily write little translators for those into dagger pipelines without too much fuss I think (maybe a fun hackathon project there) - maybe inspired by @wingyplus if there's source code available 🎉

It's something like this https://github.com/wingyplus/d2d/blob/main/main.go. But I didn't continue digging further due to my busy work. 😢

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants