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

feat(CLI): Generate Dockerfile from build.envd #523

Open
gaocegege opened this issue Jun 28, 2022 · 7 comments
Open

feat(CLI): Generate Dockerfile from build.envd #523

gaocegege opened this issue Jun 28, 2022 · 7 comments

Comments

@gaocegege
Copy link
Member

Description

As an ML infra engineer, I may want to get the Dockerfile from the envd, instead of building the image, to integrate envd into the internal existing infrastructures.

$ envd build --output type=dockerfile
envd.Dockerfile is generated

Message from the maintainers:

Love this enhancement proposal? Give it a 👍. We prioritise the proposals with the most 👍.

@aseaday
Copy link
Member

aseaday commented Jun 28, 2022

I am working on this. and the cli could better:

envd build --dryrun=dockerfile

@gaocegege
Copy link
Member Author

@aseaday Thanks for your contribution!

Would you mind me assigning this issue to you?

BTW, how do you plan to implement it? I think we need to make ir.Graph an interface, then implement the compile func for dryrun and buildkit llb.

@aseaday
Copy link
Member

aseaday commented Jun 29, 2022

Assign it to me. I would give a plan first and any suggestions?

@gaocegege
Copy link
Member Author

I think we can make ir.Graph an interface instead of the struct. Then dryrun and buildkit llb generation are two different implementations for the interface.

@gaocegege
Copy link
Member Author

Hi, is there some progress?

@aseaday
Copy link
Member

aseaday commented Jul 13, 2022

Hi, is there some progress?

I am still working on part rescontruct from those lines:

	root = llb.User("envd")(root)
	// Refer to https://github.com/moby/buildkit/blob/31054718bf775bf32d1376fe1f3611985f837584/frontend/dockerfile/dockerfile2llb/convert_runmount.go#L46
	cache := root.File(llb.Mkdir("/cache",
		0755, llb.WithParents(true), llb.WithUIDGID(g.uid, g.gid)),
		llb.WithCustomName("[internal] settings conda cache mount permissions"))
	run := root.
		Run(llb.Shlex(cmd), llb.WithCustomNamef("conda install %s",
			strings.Join(g.CondaPackages, " ")))
	run.AddMount(cacheDir, cache,
		llb.AsPersistentCacheDir(g.CacheID(cacheDir), llb.CacheMountShared), llb.SourcePath("/cache"))

I think I could finish it by the end of this month.

@aseaday
Copy link
Member

aseaday commented Jul 13, 2022

I would decide the final solutions method this weekend:

  • Continue to convert the llb.state to Dockerfile
  • Constrcut the a structure as the interfaces of llb.state but in fact it is a dockerfile builder

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Status: No status
Development

No branches or pull requests

2 participants