8000 fix: use buildkit container builder to export cache by kemingy · Pull Request #1975 · tensorchord/envd · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

fix: use buildkit container builder to export cache #1975

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

Merged
merged 2 commits into from
Feb 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,8 @@ jobs:
include:
- build_func: build
tag_suffix: ""
- build_func: build_gpu_11_6
tag_suffix: "-cuda-11.6.2-cudnn-8"
- build_func: build_gpu_11_8
tag_suffix: "-cuda-11.8.0-cudnn-8"
needs: goreleaser
steps:
- uses: actions/checkout@v4
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -260,10 +260,10 @@ NAME JUPYTER SSH TARGET CONTEXT
envd-quick-start http://localhost:42779 envd-quick-start.envd /home/gaocegege/code/envd-quick-start envd-quick-start:dev false <none> <none> Up 54 seconds bd3f6a729e94
```

## Difference between v0 and v1
## Difference between v0 and v1 syntax

> [!NOTE]
> Start from `envd v1.0`, `v1` syntax is the default syntax for `build.envd` file.
> Start from `envd v1.0`, `v1` syntax is the default syntax for `build.envd` file, and `moby-worker` is the default builder.

| Features | v0 | v1 |
| --- | --- | --- |
Expand Down
1 change: 1 addition & 0 deletions base-images/remote-cache/build-and-push-remote-cache.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ TAG_SUFFIX="${TAG_SUFFIX:-}"

cd ${ROOT_DIR}

envd context create --name docker --builder docker-container --use
envd --debug build -f build.envd:${BUILD_FUNC} --export-cache type=registry,ref=docker.io/${DOCKER_HUB_ORG}/python-cache:envd-v${ENVD_VERSION}${TAG_SUFFIX} --force

cd - > /dev/null
30 changes: 7 additions & 23 deletions base-images/remote-cache/build.envd
Original file line number Diff line number Diff line change
Expand Up @@ -5,40 +5,24 @@ def build():
install.python()


def build_gpu_11_2():
"""tensorflow"""
base(dev=True)
install.conda()
install.python()
install.cuda(version="11.2.2", cudnn="8")


def build_gpu_11_3():
"""pytorch"""
base(dev=True)
install.conda()
install.python()
install.cuda(version="11.3.1", cudnn="8")


def build_gpu_11_6():
"""pytorch"""
def build_gpu_11_8():
"""cuda 11"""
base(dev=True)
install.conda()
install.python()
install.cuda(version="11.6.2", cudnn="8")
install.cuda(version="11.8.0", cudnn="8")


def build_gpu_11_8():
"""pytorch"""
def build_gpu_12_2():
"""cuda 12"""
base(dev=True)
install.conda()
install.python()
install.cuda(version="11.8.0", cudnn="8")
install.cuda(version="12.2.2", cudnn="8")


def build_gpu_12_3():
"""pytorch"""
"""cudnn 9"""
base(dev=True)
install.conda()
install.python()
Expand Down
2 changes: 1 addition & 1 deletion pkg/app/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ To build and push the image to a registry:
// https://github.com/urfave/cli/issues/1134#issuecomment-1191407527
&cli.StringFlag{
Name: "export-cache",
Usage: "Export the cache (e.g. `type=registry,ref=<image>`)",
Usage: "Export the cache (e.g. `type=registry,ref=<image>`). The default `moby-worker` builder doesn't support this unless the docker-ce has enabled the `containerd` image store. You can run `envd context create --name docker --builder docker-container --use` to use this feature.",
Aliases: []string{"ec"},
},
&cli.StringFlag{
Expand Down
2 changes: 1 addition & 1 deletion pkg/app/up.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ var CommandUp = &cli.Command{
// https://github.com/urfave/cli/issues/1134#issuecomment-1191407527
&cli.StringFlag{
Name: "export-cache",
Usage: "Export the cache (e.g. `type=registry,ref=<image>`)",
Usage: "Export the cache (e.g. `type=registry,ref=<image>`). The default `moby-worker` builder doesn't support this unless the docker-ce has enabled the `containerd` image store. You can run `envd context create --name docker --builder docker-container --use` to use this feature.",
Aliases: []string{"ec"},
},
&cli.StringFlag{
Expand Down
1 change: 0 additions & 1 deletion pkg/builder/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,6 @@ func (b generalBuilder) build(ctx context.Context, pw progresswriter.Writer) err
if err != nil {
return errors.Wrap(err, "failed to parse export cache")
}
// k := platforms.Format(platforms.DefaultSpec())
ctx, cancel := context.WithCancel(ctx)
defer cancel()
eg, ctx := errgroup.WithContext(ctx)
Expand Down
1 change: 0 additions & 1 deletion pkg/lang/ir/v1/r.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ const rPath = "/usr/local/lib/R/site-library"
func (g *generalGraph) installRLang(root llb.State) llb.State {
g.UserDirectories = append(g.UserDirectories, rPath)
prepare := root.Run(llb.Shlex(`sh -c "
apt-get update && apt-get install -y --no-install-recommends --fix-missing gpg &&
wget -qO- https://cloud.r-project.org/bin/linux/ubuntu/marutter_pubkey.asc | gpg --dearmor -o /usr/share/keyrings/r-project.gpg &&
echo "deb [signed-by=/usr/share/keyrings/r-project.gpg] https://cloud.r-project.org/bin/linux/ubuntu jammy-cran40/" | tee -a /etc/apt/sources.list.d/r-project.list
"`), llb.WithCustomName("add R public GPG key")).Root()
Expand Down
2 changes: 1 addition & 1 deletion pkg/lang/version/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ func New(file string) (Getter, error) {
} else if strings.Contains(comment, "# syntax=v0") {
logrus.Fatal("v0 is no longer supported in envd v1, try to use v1")
} else {
logrus.Debug("unknown version, using v0 by default")
logrus.Debug("unknown version, using v1 by default")
}
g.v = V1
return g, nil
Expand Down
2 changes: 2 additions & 0 deletions pkg/types/envd.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ var BaseEnvironment = []struct {
{"PATH", DefaultSystemPath},
{"LANG", "en_US.UTF-8"},
{"LC_ALL", "en_US.UTF-8"},
{"UV_LINK_MODE", "copy"}, // uv link-mode for installing Python packages
}
var BaseAptPackage = []string{
"bash-static",
Expand All @@ -82,6 +83,7 @@ var BaseAptPackage = []string{
"make",
"zsh",
"locales",
"gpg", // used by r-lang
}

type EnvdImage struct {
Expand Down
Loading
0