Skip to content

Commit

Permalink
copy envd-sshd
Browse files Browse the repository at this point in the history
Signed-off-by: Keming <kemingyang@tensorchord.ai>
  • Loading branch information
kemingy committed Sep 26, 2022
1 parent f58e55b commit 7327c13
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
4 changes: 2 additions & 2 deletions base-images/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ docker run --rm --privileged multiarch/qemu-user-static --reset -p yes

docker buildx build \
--build-arg ENVD_VERSION=${ENVD_VERSION} \
--build-arg ENVD_SSH_IMAGE=ghcr.io/tensorchord/envd-sshd-from-scratch \
--build-arg ENVD_SSH_IMAGE=tensorchord/envd-sshd-from-scratch \
--pull --push --platform linux/x86_64,linux/arm64 \
-t ${DOCKER_HUB_ORG}/python:${PYTHON_VERSION}-${ENVD_OS}-envd-${DOCKER_IMAGE_TAG} \
-f python${PYTHON_VERSION}-${ENVD_OS}.Dockerfile .
docker buildx build --build-arg IMAGE_NAME=docker.io/nvidia/cuda \
--build-arg ENVD_VERSION=${ENVD_VERSION} \
--build-arg ENVD_SSH_IMAGE=ghcr.io/tensorchord/envd-sshd-from-scratch \
--build-arg ENVD_SSH_IMAGE=tensorchord/envd-sshd-from-scratch \
--pull --push --platform linux/x86_64,linux/arm64 \
-t ${DOCKER_HUB_ORG}/python:${PYTHON_VERSION}-${ENVD_OS}-cuda11.2-cudnn8-envd-${DOCKER_IMAGE_TAG} \
-f python${PYTHON_VERSION}-${ENVD_OS}-cuda11.2.Dockerfile .
Expand Down
7 changes: 6 additions & 1 deletion pkg/lang/ir/system.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,11 @@ func (g *Graph) preparePythonBase() llb.State {
base = base.AddEnv(env.Name, env.Value)
}

// envd-sshd
sshd := base.File(llb.Copy(
llb.Image(types.EnvdSshdImage), "/usr/bin/envd-sshd", "/var/envd/bin/envd-sshd",
&llb.CopyInfo{CreateDestPath: true}))

// apt packages
var sb strings.Builder
sb.WriteString("apt-get update && apt-get install -y apt-utils && ")
Expand All @@ -164,7 +169,7 @@ func (g *Graph) preparePythonBase() llb.State {
cacheDir := "/var/cache/apt"
cacheLibDir := "/var/lib/apt"

run := base.Run(llb.Shlex(fmt.Sprintf("bash -c \"%s\"", sb.String())), llb.WithCustomNamef(sb.String()))
run := sshd.Run(llb.Shlex(fmt.Sprintf("bash -c \"%s\"", sb.String())), llb.WithCustomNamef(sb.String()))
run.AddMount(cacheDir, llb.Scratch(),
llb.AsPersistentCacheDir(g.CacheID(cacheDir), llb.CacheMountShared))
run.AddMount(cacheLibDir, llb.Scratch(),
Expand Down
6 changes: 6 additions & 0 deletions pkg/types/envd.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,12 @@ package types

import (
"encoding/json"
"fmt"

"github.com/docker/docker/api/types"
"github.com/moby/buildkit/util/system"

"github.com/tensorchord/envd/pkg/version"
)

// DefaultPathEnvUnix is unix style list of directories to search for
Expand All @@ -33,6 +36,9 @@ const DefaultPathEnvWindows = system.DefaultPathEnvWindows

const PythonBaseImage = "ubuntu:20.04"

var EnvdSshdImage = fmt.Sprintf(
"tensorchord/envd-sshd-from-scratch:%s", version.GetEnvdVersion())

var BaseEnvironment = []struct {
Name string
Value string
Expand Down

0 comments on commit 7327c13

Please sign in to comment.