diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e9ab3606c..26cfadfb8 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -4,6 +4,11 @@ on: release: types: [published] +# to publish ghcr.io +permissions: + contents: write + packages: write + jobs: goreleaser: if: github.repository == 'tensorchord/envd' @@ -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 }} diff --git a/.goreleaser.yaml b/.goreleaser.yaml index 2fc981a3e..ea1c02b54 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -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 @@ -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 @@ -81,7 +82,7 @@ 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: @@ -89,7 +90,7 @@ dockers: 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: @@ -98,7 +99,7 @@ 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: @@ -106,7 +107,7 @@ dockers: 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: @@ -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 diff --git a/base-images/build.sh b/base-images/build.sh index 95d562c5d..54f45c3f7 100755 --- a/base-images/build.sh +++ b/base-images/build.sh @@ -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}" @@ -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 diff --git a/base-images/envd-starship/envd-starship.Dockerfile b/base-images/envd-starship/envd-starship.Dockerfile index d478b47dd..4bad14be1 100644 --- a/base-images/envd-starship/envd-starship.Dockerfile +++ b/base-images/envd-starship/envd-starship.Dockerfile @@ -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 \ No newline at end of file +COPY --from=builder /usr/local/bin/starship /usr/local/bin/starship diff --git a/base-images/envd/build.sh b/base-images/envd/build.sh index 0313327c8..57ac375d9 100755 --- a/base-images/envd/build.sh +++ b/base-images/envd/build.sh @@ -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} diff --git a/base-images/envd/envd-daemonless.Dockerfile b/base-images/envd/envd-daemonless.Dockerfile index 002264571..4d0ee0b94 100644 --- a/base-images/envd/envd-daemonless.Dockerfile +++ b/base-images/envd/envd-daemonless.Dockerfile @@ -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 diff --git a/base-images/remote-cache/build-and-push-remote-cache.sh b/base-images/remote-cache/build-and-push-remote-cache.sh index a48ce7a76..87d5c3c1d 100755 --- a/base-images/remote-cache/build-and-push-remote-cache.sh +++ b/base-images/remote-cache/build-and-push-remote-cache.sh @@ -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 diff --git a/pkg/builder/build_func.go b/pkg/builder/build_func.go index 21b13fd9a..826f8eac9 100644 --- a/pkg/builder/build_func.go +++ b/pkg/builder/build_func.go @@ -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 { diff --git a/pkg/lang/ir/v0/compile.go b/pkg/lang/ir/v0/compile.go index 176d6d4d4..08deeb01a 100644 --- a/pkg/lang/ir/v0/compile.go +++ b/pkg/lang/ir/v0/compile.go @@ -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()) } diff --git a/pkg/lang/ir/v0/system.go b/pkg/lang/ir/v0/system.go index 7bbdbafe6..d1107d20f 100644 --- a/pkg/lang/ir/v0/system.go +++ b/pkg/lang/ir/v0/system.go @@ -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 { @@ -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") diff --git a/pkg/types/envd.go b/pkg/types/envd.go index 16b78336b..47c43b9c1 100644 --- a/pkg/types/envd.go +++ b/pkg/types/envd.go @@ -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 {