tensorchord / envd

🏕️ Reproducible development environment
https://envd.tensorchord.ai/
Apache License 2.0
1.95k stars 156 forks source link

feat(lang): Support Source Code Management #6

Open gaocegege opened 2 years ago

gaocegege commented 2 years ago

Description

Code may be one of the first-class objects in the build language. The code will exist in the resulting container and users develop models and update them. After the code is changed, you can commit and push to remote.

CODE:
    GIT SSH /root/.ssh/github-key
    GIT LOCAL $HOME/private-repo
    GIT CLONE git@github.com/tensorchord/private-repo.git
    # TODO: Support branch and commit

Feature lists

gaocegege commented 2 years ago

Public git repo clone:

    python := llb.Image("docker.io/library/python:3.8")
    run1 := python.Run(llb.Shlex("pip install -i https://mirror.sjtu.edu.cn/pypi/web/simple jupyter"))
    run1.AddMount("/root/.cache/pip", llb.Scratch())
    run1.AddMount("/root/.cache/pip", llb.Scratch(), llb.AsPersistentCacheDir("//root/.cache/pip", llb.CacheMountShared))

    src := llb.Git("https://github.com/gaocegege/hello-ci", "da79477ffa488c91e208b7b93c26bf46f18b8ce3", llb.KeepGitDir())
    run2 := python.File(llb.Copy(src, ".", "/root/midi"))

    run := python.Run(llb.Shlex("pip install -i https://mirror.sjtu.edu.cn/pypi/web/simple ormb"))
    run.AddMount("/root/.cache/pip", llb.Scratch())
    run.AddMount("/root/.cache/pip", llb.Scratch(), llb.AsPersistentCacheDir("//root/.cache/pip", llb.CacheMountShared))
    new := llb.Merge([]llb.State{run.State, run1.State, run2})
    return new