dagger / dagger

An engine to run your pipelines in containers

Home Page:https://dagger.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

✨ Create Dockerfile from Dagger

levlaz opened this issue · comments

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.

I remember i wrote it somewhere on my machine.😃

But some instructions are not supported by Dagger.

I remember i wrote it somewhere on my machine.😃

What do you mean by this? :)

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.

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

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 🎉

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. 😢