Skip to content

Commit 694b227

Browse files
authored
feat: push to ghcr (#2063)
Signed-off-by: Keming <kemingyang@tensorchord.ai>
1 parent 0e28965 commit 694b227

File tree

5 files changed

+32
-23
lines changed

5 files changed

+32
-23
lines changed

.github/workflows/release.yml

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ on:
88
jobs:
99
goreleaser:
1010
runs-on: ubuntu-latest
11+
permissions:
12+
contents: write
13+
packages: write
1114
steps:
1215
- name: Checkout
1316
uses: actions/checkout@v5
@@ -17,11 +20,17 @@ jobs:
1720
uses: actions/setup-go@v6
1821
with:
1922
go-version: 'stable'
20-
- name: Login to Docker
23+
- name: Login to Docker Hub
2124
uses: docker/login-action@v3
2225
with:
2326
username: ${{ secrets.DOCKERIO_USERNAME }}
2427
password: ${{ secrets.DOCKERIO_TOKEN }}
28+
- name: Login to GitHub Container Registry
29+
uses: docker/login-action@v3
30+
with:
31+
registry: ghcr.io
32+
username: ${{ github.actor }}
33+
password: ${{ secrets.GITHUB_TOKEN }}
2534
- name: Set up Docker Buildx
2635
uses: docker/setup-buildx-action@v3
2736
- name: Run GoReleaser
@@ -114,6 +123,9 @@ jobs:
114123
if: github.repository == 'tensorchord/envd' && startsWith(github.ref, 'refs/tags/v')
115124
runs-on: ubuntu-latest
116125
needs: goreleaser
126+
permissions:
127+
contents: read
128+
packages: write
117129
steps:
118130
- uses: actions/checkout@v5
119131
- name: Set up Docker Buildx
@@ -126,11 +138,12 @@ jobs:
126138
key: ${{ runner.os }}-buildx-${{ github.sha }}
127139
restore-keys: |
128140
${{ runner.os }}-buildx-
129-
- name: Docker Login
141+
- name: Login to GitHub Container Registry
130142
uses: docker/login-action@v3
131143
with:
132-
username: ${{ secrets.DOCKERIO_USERNAME }}
133-
password: ${{ secrets.DOCKERIO_TOKEN }}
144+
registry: ghcr.io
145+
username: ${{ github.actor }}
146+
password: ${{ secrets.GITHUB_TOKEN }}
134147
- name: Docker Buildx
135148
run: |
136149
./base-images/envd/build.sh
@@ -139,14 +152,15 @@ jobs:
139152
# only trigger on main repo when tag starts with v
140153
if: github.repository == 'tensorchord/envd' && startsWith(github.ref, 'refs/tags/v')
141154
runs-on: ubuntu-latest
155+
permissions:
156+
contents: read
157+
packages: write
142158
strategy:
143159
fail-fast: false
144160
matrix:
145161
include:
146162
- build_func: build
147163
tag_suffix: ""
148-
- build_func: build_gpu_11_8
149-
tag_suffix: "-cuda-11.8.0-cudnn-8"
150164
needs: goreleaser
151165
steps:
152166
- uses: actions/checkout@v5
@@ -170,11 +184,12 @@ jobs:
170184
run: |
171185
mv dist/envd_linux_amd64_v1/envd /usr/local/bin/envd
172186
chmod +x /usr/local/bin/envd
173-
- name: Docker Login
187+
- name: Login to GitHub Container Registry
174188
uses: docker/login-action@v3
175189
with:
176-
username: ${{ secrets.DOCKERIO_USERNAME }}
177-
password: ${{ secrets.DOCKERIO_TOKEN }}
190+
registry: ghcr.io
191+
username: ${{ github.actor }}
192+
password: ${{ secrets.GITHUB_TOKEN }}
178193
- name: Build and push
179194
run: ./base-images/remote-cache/build-and-push-remote-cache.sh
180195
env:

.goreleaser.yaml

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -47,21 +47,13 @@ archives:
4747
ids:
4848
- envd
4949
name_template: >-
50-
{{ .Binary }}_{{ .Version }}_
51-
{{- title .Os }}_
52-
{{- if eq .Arch "amd64" }}x86_64
53-
{{- else if eq .Arch "386" }}i386
54-
{{- else }}{{ .Arch }}{{ end }}
50+
{{ .Binary }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}
5551
- id: envd-sshd
5652
formats: ["binary"]
5753
ids:
5854
- envd-sshd
5955
name_template: >-
60-
{{ .Binary }}_{{ .Version }}_
61-
{{- title .Os }}_
62-
{{- if eq .Arch "amd64" }}x86_64
63-
{{- else if eq .Arch "386" }}i386
64-
{{- else }}{{ .Arch }}{{ end }}
56+
{{ .Binary }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}
6557
checksum:
6658
name_template: 'checksums.txt'
6759
snapshot:
@@ -88,6 +80,7 @@ dockers_v2:
8880
- id: "envd"
8981
images:
9082
- "tensorchord/envd-from-scratch"
83+
- "ghcr.io/tensorchord/envd-from-scratch"
9184
dockerfile: base-images/envd/envd.Dockerfile
9285
ids: ["envd"]
9386
tags:
@@ -98,6 +91,7 @@ dockers_v2:
9891
- id: "envd-sshd"
9992
images:
10093
- "tensorchord/envd-sshd-from-scratch"
94+
- "ghcr.io/tensorchord/envd-sshd-from-scratch"
10195
dockerfile: base-images/envd-sshd/envd-sshd.Dockerfile
10296
ids: ["envd-sshd"]
10397
tags:

base-images/envd/build.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,15 @@ ROOT_DIR=`dirname $0`
2020

2121
GIT_TAG_VERSION=$(git describe --tags --abbrev=0)
2222
ENVD_VERSION="${ENVD_VERSION:-$GIT_TAG_VERSION}"
23-
DOCKER_HUB_ORG="${DOCKER_HUB_ORG:-tensorchord}"
23+
DOCKER_HUB_ORG="${DOCKER_HUB_ORG:-ghcr.io/tensorchord}"
2424
TAG_SUFFIX="${TAG_SUFFIX:-}"
2525

2626
cd ${ROOT_DIR}
2727

2828
docker buildx build \
2929
--build-arg ENVD_VERSION=${ENVD_VERSION} \
3030
-t ${DOCKER_HUB_ORG}/envd:${ENVD_VERSION}-rootless \
31-
--pull --push --platform linux/x86_64,linux/arm64 \
31+
--pull --push --platform linux/amd64,linux/arm64 \
3232
-f envd-daemonless.Dockerfile ../../
3333

3434
cd - > /dev/null

base-images/envd/envd-daemonless.Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
ARG ENVD_VERSION
22

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

55
FROM moby/buildkit:v0.25.1-rootless
66
COPY --from=envd /usr/bin/envd /usr/bin/envd

base-images/remote-cache/build-and-push-remote-cache.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,6 @@ TAG_SUFFIX="${TAG_SUFFIX:-}"
2727
cd ${ROOT_DIR}
2828

2929
envd context create --name docker --builder docker-container --use
30-
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
30+
envd --debug build -f build.envd:${BUILD_FUNC} --export-cache type=registry,ref=ghcr.io/${DOCKER_HUB_ORG}/python-cache:envd-v${ENVD_VERSION}${TAG_SUFFIX} --force
3131

3232
cd - > /dev/null

0 commit comments

Comments
 (0)