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: adopt ghcr #1959

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
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
16 changes: 11 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ on:
release:
types: [published]

# to publish ghcr.io
permissions:
contents: write
packages: write

jobs:
goreleaser:
if: github.repository == 'tensorchord/envd'
Expand All @@ -17,16 +22,17 @@ jobs:
uses: actions/setup-go@v5
with:
go-version: 'stable'
- name: Docker Login
- name: Login to ghcr.io
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERIO_USERNAME }}
password: ${{ secrets.DOCKERIO_TOKEN }}
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v4
uses: goreleaser/goreleaser-action@v6
with:
distribution: goreleaser
version: latest
version: "~> v2"
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
23 changes: 12 additions & 11 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# This is an example .goreleaser.yml file with some sensible defaults.
# Make sure to check the documentation at https://goreleaser.com
version: 2
before:
hooks:
- go mod tidy
Expand Down Expand Up @@ -60,7 +61,7 @@ archives:
checksum:
name_template: 'checksums.txt'
snapshot:
name_template: "{{ incpatch .Version }}-next"
version_template: "{{ incpatch .Version }}-next"
changelog:
use: github
sort: asc
Expand All @@ -81,15 +82,15 @@ changelog:
order: 999
dockers:
- image_templates:
- "tensorchord/envd-from-scratch:v{{ .Version }}-amd64"
- "ghcr.io/tensorchord/envd-from-scratch:v{{ .Version }}-amd64"
use: buildx
dockerfile: base-images/envd/envd.Dockerfile
ids:
- envd
build_flag_templates:
- "--platform=linux/amd64"
- image_templates:
- "tensorchord/envd-from-scratch:v{{ .Version }}-arm64v8"
- "ghcr.io/tensorchord/envd-from-scratch:v{{ .Version }}-arm64v8"
use: buildx
goarch: arm64
ids:
Expand All @@ -98,15 +99,15 @@ dockers:
build_flag_templates:
- "--platform=linux/arm64/v8"
- image_templates:
- "tensorchord/envd-sshd-from-scratch:v{{ .Version }}-amd64"
- "ghcr.io/tensorchord/envd-sshd-from-scratch:v{{ .Version }}-amd64"
use: buildx
dockerfile: base-images/envd-sshd/envd-sshd.Dockerfile
ids:
- envd-sshd
build_flag_templates:
- "--platform=linux/amd64"
- image_templates:
- "tensorchord/envd-sshd-from-scratch:v{{ .Version }}-arm64v8"
- "ghcr.io/tensorchord/envd-sshd-from-scratch:v{{ .Version }}-arm64v8"
use: buildx
goarch: arm64
ids:
Expand All @@ -115,11 +116,11 @@ dockers:
build_flag_templates:
- "--platform=linux/arm64/v8"
docker_manifests:
- name_template: tensorchord/envd-sshd-from-scratch:v{{ .Version }}
- name_template: ghcr.io/tensorchord/envd-sshd-from-scratch:v{{ .Version }}
image_templates:
- tensorchord/envd-sshd-from-scratch:v{{ .Version }}-amd64
- tensorchord/envd-sshd-from-scratch:v{{ .Version }}-arm64v8
- name_template: tensorchord/envd-from-scratch:v{{ .Version }}
- ghcr.io/tensorchord/envd-sshd-from-scratch:v{{ .Version }}-amd64
- ghcr.io/tensorchord/envd-sshd-from-scratch:v{{ .Version }}-arm64v8
- name_template: ghcr.io/tensorchord/envd-from-scratch:v{{ .Version }}
image_templates:
- tensorchord/envd-from-scratch:v{{ .Version }}-amd64
- tensorchord/envd-from-scratch:v{{ .Version }}-arm64v8
- ghcr.io/tensorchord/envd-from-scratch:v{{ .Version }}-amd64
- ghcr.io/tensorchord/envd-from-scratch:v{{ .Version }}-arm64v8
11 changes: 6 additions & 5 deletions base-images/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ set -euo pipefail
ROOT_DIR=`dirname $0`

GIT_TAG_VERSION=$(git describe --tags --abbrev=0)
DOCKER_HUB_ORG="${DOCKER_HUB_ORG:-tensorchord}"
DOCKER_HUB_ORG="${DOCKER_HUB_ORG:-ghcr.io/tensorchord}"
ENVD_SSHD_IMAGE="{ENVD_SSHD_IMAGE:-ghcr.io/tensorchord/envd-sshd-from-scratch}"
ENVD_OS="${ENVD_OS:-ubuntu22.04}"
JULIA_VERSION="${JULIA_VERSION:-1.8rc1}"
RLANG_VERSION="${RLANG_VERSION:-4.2}"
Expand All @@ -34,14 +35,14 @@ docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
# TODO(gaocegege): Support linux/arm64
docker buildx build \
--build-arg ENVD_VERSION=${GIT_TAG_VERSION} \
--build-arg ENVD_SSHD_IMAGE=tensorchord/envd-sshd-from-scratch \
-t ${DOCKER_HUB_ORG}/r-base:${RLANG_VERSION}-envd-${GIT_TAG_VERSION} \
--build-arg ENVD_SSHD_IMAGE=${ENVD_SSHD_IMAGE} \
-t ${DOCKER_HUB_ORG}/envd-r-base:${RLANG_VERSION}-${GIT_TAG_VERSION} \
--pull --push --platform linux/x86_64 \
-f r${RLANG_VERSION}.Dockerfile .
docker buildx build \
--build-arg ENVD_VERSION=${GIT_TAG_VERSION} \
--build-arg ENVD_SSHD_IMAGE=tensorchord/envd-sshd-from-scratch \
-t ${DOCKER_HUB_ORG}/julia:${JULIA_VERSION}-${ENVD_OS}-envd-${GIT_TAG_VERSION} \
--build-arg ENVD_SSHD_IMAGE=${ENVD_SSHD_IMAGE} \
-t ${DOCKER_HUB_ORG}/envd-julia:${JULIA_VERSION}-${ENVD_OS}-${GIT_TAG_VERSION} \
--pull --push --platform linux/x86_64,linux/arm64 \
-f julia${JULIA_VERSION}-${ENVD_OS}.Dockerfile .
cd - > /dev/null
4 changes: 2 additions & 2 deletions base-images/envd-starship/envd-starship.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM curlimages/curl:7.87.0 as builder
FROM curlimages/curl:8.11.1 as builder
USER root
RUN curl --proto '=https' --tlsv1.2 -sSf https://starship.rs/install.sh | sh -s -- -y

FROM scratch as prod
COPY --from=builder /usr/local/bin/starship /usr/local/bin/starship
COPY --from=builder /usr/local/bin/starship /usr/local/bin/starship
2 changes: 1 addition & 1 deletion base-images/envd/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ ROOT_DIR=`dirname $0`

GIT_TAG_VERSION=$(git describe --tags --abbrev=0)
ENVD_VERSION="${ENVD_VERSION:-$GIT_TAG_VERSION}"
DOCKER_HUB_ORG="${DOCKER_HUB_ORG:-tensorchord}"
DOCKER_HUB_ORG="${DOCKER_HUB_ORG:-ghcr.io/tensorchord}"
TAG_SUFFIX="${TAG_SUFFIX:-}"

cd ${ROOT_DIR}
Expand Down
2 changes: 1 addition & 1 deletion base-images/envd/envd-daemonless.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
ARG ENVD_VERSION

FROM tensorchord/envd-from-scratch:${ENVD_VERSION} as envd
FROM ghcr.io/tensorchord/envd-from-scratch:${ENVD_VERSION} as envd

FROM moby/buildkit:v0.10.5-rootless
COPY --from=envd /usr/bin/envd /usr/bin/envd
Expand Down
4 changes: 2 additions & 2 deletions base-images/remote-cache/build-and-push-remote-cache.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ ROOT_DIR=`dirname $0`

GIT_TAG_VERSION=$(git describe --tags --abbrev=0 | sed -r 's/[v]+//g') # remove v from version
ENVD_VERSION="${ENVD_VERSION:-$GIT_TAG_VERSION}"
DOCKER_HUB_ORG="${DOCKER_HUB_ORG:-tensorchord}"
DOCKER_HUB_ORG="${DOCKER_HUB_ORG:-ghcr.io/tensorchord}"
BUILD_FUNC="${BUILD_FUNC:-build}"
TAG_SUFFIX="${TAG_SUFFIX:-}"

cd ${ROOT_DIR}

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
envd --debug build -f build.envd:${BUILD_FUNC} --export-cache type=registry,ref=${DOCKER_HUB_ORG}/envd-python-cache:v${ENVD_VERSION}${TAG_SUFFIX} --force

cd - > /dev/null
2 changes: 1 addition & 1 deletion pkg/builder/build_func.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func (b generalBuilder) BuildFunc() func(ctx context.Context, c client.Client) (
Definition: b.definition.ToPB(),
}

// Get the envd default cache importer in docker.io/tensorchord/...
// Get the envd default cache importer in ghcr.io/tensorchord/...
if defaultImporter, err := b.defaultCacheImporter(); err != nil {
return nil, errors.Wrap(err, "failed to get default importer")
} else if defaultImporter != nil {
Expand Down
4 changes: 2 additions & 2 deletions pkg/lang/ir/v0/compile.go
Original file line number Diff line number Diff line change
Expand Up @@ -297,12 +297,12 @@ func (g generalGraph) DefaultCacheImporter() (*string, error) {
var res string
if g.CUDA != nil {
res = fmt.Sprintf(
"type=registry,ref=docker.io/%s/python-cache:envd-%s-cuda-%s-cudnn-%s",
"type=registry,ref=ghcr.io/%s/envd-python-cache:%s-cuda-%s-cudnn-%s",
viper.GetString(flag.FlagDockerOrganization),
version.GetVersionForImageTag(), *g.CUDA, g.CUDNN)
} else {
res = fmt.Sprintf(
"type=registry,ref=docker.io/%s/python-cache:envd-%s",
"type=registry,ref=ghcr.io/%s/envd-python-cache:%s",
viper.GetString(flag.FlagDockerOrganization),
version.GetVersionForImageTag())
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/lang/ir/v0/system.go
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ func (g *generalGraph) compileBase() (llb.State, error) {
} else if g.CUDA == nil {
switch g.Language.Name {
case "r":
base = llb.Image(fmt.Sprintf("docker.io/%s/r-base:4.2-envd-%s", org, v))
base = llb.Image(fmt.Sprintf("ghcr.io/%s/envd-r-base:4.2-%s", org, v))
// r-base image already has GID 1000.
// It is a trick, we actually use GID 1000
if g.gid == 1000 {
Expand All @@ -218,7 +218,7 @@ func (g *generalGraph) compileBase() (llb.State, error) {
base = g.preparePythonBase(llb.Image(types.PythonBaseImage))
case "julia":
base = llb.Image(fmt.Sprintf(
"docker.io/%s/julia:1.8rc1-ubuntu22.04-envd-%s", org, v))
"ghcr.io/%s/envd-julia:1.8rc1-ubuntu22.04-%s", org, v))
}
} else {
base = g.compileCUDAPackages("nvidia/cuda")
Expand Down
2 changes: 1 addition & 1 deletion pkg/types/envd.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ const (
)

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

var BaseEnvironment = []struct {
Expand Down
Loading