Multi-target Build
envd supports building different container images from one single file, for different purpose. Typical scenario includes:
- Use CPU for model development, need GPU for large scale training jobs
- Use
envdin daily development, but want to containerize dependency and publish it for model serving - Require both X86 and ARM platforms.
Usage
Command envd up -f {build_file}:{build_func} can specify the build target, by running the build_func in build_file.
For example, you can declare multiple functions in one envd file, following python's syntax
python
def build():
base(dev=True)
install.conda()
install.python()
install.vscode_extensions([
"ms-python.python",
])
install.python_packages([
"tensorflow",
"numpy",
])
shell("zsh")
config.jupyter(token="", port=8888)
def build_gpu():
build() # include all dependency declared in build function
install.cuda(version="11.2.2", cudnn="8")Then, to start with cpu, any of commands below works the same way
envd up, this will runbuildfunction inbuild.envdfile in current working directoryenvd up -f :build, explicitly specifybuildfunctionenvd up -f build.envd, explicitly specifybuild.envdenvd up -f build.envd:build, explicitly specify bothbuild.envdandbuildfunction
Similarly, if you want to start with cuda support declared in build_gpu function, you can try
envd up -f :build_gpu, explicitly specifybuild_gpufunctionenvd up -f build.envd:build_gpu, explicitly specify bothbuild.envdandbuild_gpufunction