Skip to content

Commit ee7feba

Browse files
authored
Switch from docker.io to ghcr.io (onnx#2976)
* Switch from docker.io to ghcr.io * Increase push retry limit * Increase docker API timeout * Fix python 3.12 SyntaxWarning: invalid escape sequence '\s' * Update default base image to ghcr.io/onnxmlir/ubuntu:jammy Signed-off-by: Gong Su <[email protected]>
1 parent 1435011 commit ee7feba

10 files changed

+22
-21
lines changed

.buildbot/Jenkinsfile

+4-4
Original file line numberDiff line numberDiff line change
@@ -49,25 +49,25 @@ def call() {
4949
DOCKER_DAEMON_SOCKET = 'unix://var/run/docker.sock'
5050
DOCKER_REGISTRY_TOKEN_ACCESS = 'true'
5151
/* Settings for docker.io */
52+
/*
5253
DOCKER_REGISTRY_HOST_NAME = ''
5354
DOCKER_REGISTRY_USER_NAME = 'onnxmlir'
5455
DOCKER_REGISTRY_LOGIN_NAME = 'onnxmlir'
56+
*/
5557
/* Settings for ghcr.io */
56-
/*
5758
DOCKER_REGISTRY_HOST_NAME = 'ghcr.io'
5859
DOCKER_REGISTRY_USER_NAME = 'onnxmlir'
5960
DOCKER_REGISTRY_LOGIN_NAME = 'onnxmlir'
60-
*/
6161

6262
/* Credentials defined in Jenkins */
6363
JENKINS_REST_API_TOKEN = credentials('Jenkins-REST-API-Token')
6464
GITHUB_REPO_ACCESS_TOKEN = credentials('jenkins-buildbot-access-token')
6565
/* Settings for docker.io */
66+
/*
6667
DOCKER_REGISTRY_LOGIN_TOKEN = credentials('DOCKERHUB-ONNXMLIR-TOKEN')
68+
*/
6769
/* Settings for ghcr.io */
68-
/*
6970
DOCKER_REGISTRY_LOGIN_TOKEN = credentials('GITHUB-ONNXMLIR-TOKEN')
70-
*/
7171

7272
/* Environment variables that depend on the arch */
7373
JENKINS_REST_API_URL = sh(returnStdout: true,

.buildbot/jenkins-build-llvm-project.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
LLVM_PROJECT_DOCKERFILE = "docker/Dockerfile.llvm-project"
88
LLVM_PROJECT_GITHUB_URL = "https://api.github.com/repos/llvm/llvm-project"
99
LLVM_PROJECT_BASE_IMAGE = {
10-
"static": "ubuntu:jammy",
10+
"static": "ghcr.io/onnxmlir/ubuntu:jammy",
1111
"shared": "registry.access.redhat.com/ubi8-minimal:latest",
1212
}
1313
LLVM_PROJECT_IMAGE = {
@@ -187,7 +187,7 @@ def setup_per_pr_llvm_project(image_type, exp):
187187
):
188188
if "stream" in line:
189189
# Keep track of the latest successful image layer
190-
m = re.match("^\s*---> ([0-9a-f]+)$", line["stream"])
190+
m = re.match(r"^\s*---> ([0-9a-f]+)$", line["stream"])
191191
if m:
192192
layer_sha256 = m.group(1)
193193
print(line["stream"], end="", flush=True)

.buildbot/jenkins-build-onnx-mlir.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ def build_per_pr_onnx_mlir(image_type, exp):
178178
):
179179
if "stream" in line:
180180
# Keep track of the latest successful image layer
181-
m = re.match("^\s*---> ([0-9a-f]+)$", line["stream"])
181+
m = re.match(r"^\s*---> ([0-9a-f]+)$", line["stream"])
182182
if m:
183183
layer_sha256 = m.group(1)
184184
print(line["stream"], end="", flush=True)

.buildbot/jenkins-watch-llvm-project.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ def build_watch_image(repo, commit, dockerfile, base_image, image_repo, image_ta
336336
):
337337
if "stream" in line:
338338
# Keep track of the latest successful image layer
339-
m = re.match("^\s*---> ([0-9a-f]+)$", line["stream"])
339+
m = re.match(r"^\s*---> ([0-9a-f]+)$", line["stream"])
340340
if m:
341341
layer_sha256 = m.group(1)
342342
print(line["stream"], end="", flush=True)

.buildbot/jenkins_common.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,11 @@
3131
MEMORY_IN_GB = os.sysconf("SC_PAGE_SIZE") * os.sysconf("SC_PHYS_PAGES") / (1024.0**3)
3232
NPROC = str(math.ceil(min(max(2, MEMORY_IN_GB / 8), os.cpu_count())))
3333

34-
RETRY_LIMIT = 5
34+
RETRY_LIMIT = 10
3535
READ_CHUNK_SIZE = 1024 * 1024
3636
BASE_BRANCH = "main"
3737

38+
DOCKER_API_TIMEOUT = 3600
3839
DOCKER_DIST_MANIFEST = "application/vnd.docker.distribution.manifest.v2+json"
3940
DOCKER_DIST_MANIFEST_LIST = "application/vnd.docker.distribution.manifest.list.v2+json"
4041

@@ -47,7 +48,7 @@
4748
docker_registry_login_token = os.getenv("DOCKER_REGISTRY_LOGIN_TOKEN")
4849
docker_registry_token_access = os.getenv("DOCKER_REGISTRY_TOKEN_ACCESS")
4950
docker_rwlock = fasteners.InterProcessReaderWriterLock(docker_pushpull_rwlock)
50-
docker_api = docker.APIClient(base_url=docker_daemon_socket)
51+
docker_api = docker.APIClient(base_url=docker_daemon_socket, timeout=DOCKER_API_TIMEOUT)
5152

5253
github_repo_access_token = os.getenv("GITHUB_REPO_ACCESS_TOKEN")
5354
github_repo_name = os.getenv("GITHUB_REPO_NAME")

docker/Dockerfile.llvm-project

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# By default, use ubuntu:jammy, remember to change Jenkins build script as well
2-
ARG BASE_IMAGE="ubuntu:jammy"
2+
ARG BASE_IMAGE="ghcr.io/onnxmlir/ubuntu:jammy"
33
FROM ${BASE_IMAGE}
44

55
# Label the image for various checking and cleanup

docker/onnx-mlir.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
import sys
3434

3535
DOCKER_SOCKET = "/var/run/docker.sock"
36-
ONNX_MLIR_IMAGE = "onnxmlir/onnx-mlir"
36+
ONNX_MLIR_IMAGE = "ghcr.io/onnxmlir/onnx-mlir"
3737
KNOWN_INPUT_TYPE = (".onnx", ".json", ".mlir")
3838

3939
mount_dirs = []

docs/Docker.md

+7-7
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ There are three ways to use ONNX-MLIR with Docker.
1212
An easy way to get started with ONNX-MLIR is to use a prebuilt Docker image.
1313
These images are created as a result of a successful merge build on the trunk.
1414
This means that the latest image represents the tip of the trunk.
15-
Currently there are both Release and Debug mode images for `amd64`, `ppc64le` and `s390x` saved in Docker Hub as, respectively, [onnxmlir/onnx-mlir](https://hub.docker.com/r/onnxmlir/onnx-mlir) and [onnxmlir/onnx-mlir-dev](https://hub.docker.com/r/onnxmlir/onnx-mlir-dev).
15+
Currently there are both Release and Debug mode images for `amd64`, `ppc64le` and `s390x` saved in Docker Hub as, respectively, [onnxmlir/onnx-mlir](https://github.com/users/onnxmlir/packages/container/onnx-mlir) and [onnxmlir/onnx-mlir-dev](https://github.com/users/onnxmlir/packages/container/onnx-mlir-dev).
1616
To use one of these images either pull it directly from Docker Hub, launch a container and run an interactive bash shell in it, or use it as the base image in a Dockerfile.
1717

1818
Here are the differences between the two Docker images.
@@ -53,7 +53,7 @@ The Dockerfile is shown here, and should be modified according to one's need. Th
5353

5454
[same-as-file]: <> (docs/docker-example/Dockerfile)
5555
```
56-
FROM onnxmlir/onnx-mlir-dev
56+
FROM ghcr.io/onnxmlir/onnx-mlir-dev
5757
WORKDIR /workdir
5858
ENV HOME=/workdir
5959
@@ -122,9 +122,9 @@ cd ~/DockerOnnxMlir
122122
# Edit the Dockerfile.
123123
vi Dockerfile
124124
# Build the Docker image.
125-
docker build --tag onnx-mlir-dev .
125+
docker build --tag ghcr.io/onnxmlir/onnx-mlir-dev .
126126
# Start a container using the Docker dashboard or a docker run command.
127-
docker run -it onnx-mlir-dev
127+
docker run -it ghcr.io/onnxmlir/onnx-mlir-dev
128128
```
129129

130130
**NOTE:** If you are using a MacBook with the Apple M1 chip, please follow the steps below for configuration:
@@ -135,11 +135,11 @@ cd ~/DockerOnnxMlir
135135
# Edit the Dockerfile.
136136
vi Dockerfile
137137
# Pull the Docker image with the specified platform
138-
docker pull --platform linux/amd64 onnxmlir/onnx-mlir-dev
138+
docker pull --platform linux/amd64 ghcr.io/onnxmlir/onnx-mlir-dev
139139
# Build the Docker image.
140-
docker build --platform linux/amd64 --tag onnx-mlir-dev .
140+
docker build --platform linux/amd64 --tag ghcr.io/onnxmlir/onnx-mlir-dev .
141141
# Start a container using the Docker dashboard or a docker run command.
142-
docker run --platform linux/amd64 -it onnx-mlir-dev
142+
docker run --platform linux/amd64 -it ghcr.io/onnxmlir/onnx-mlir-dev
143143
```
144144

145145
Tip: Instead of adding the platform flag for every docker pull, build, and run command. You can set the environment variable `DOCKER_DEFAULT_PLATFORM` and use the first set of steps:

docs/TestingHighLevel.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ If you run into protobuf related errors during the build, check the following po
4040
* llvm-project, onnx, and/or onnx-mlir may detect different versions of python3 (so watch their cmake output) if you have multiple python versions installed
4141
* cmake caches stuff and you should never use "make clean" when rebuilding. Instead remove everything under the build tree and start from scratch.
4242

43-
These and many other trickeries for setting up the build env are the reason why we recommend using the `onnxmlir/onnx-mlir-dev` docker image for development.
43+
These and many other trickeries for setting up the build env are the reason why we recommend using the [onnxmlir/onnx-mlir-dev](https://github.com/users/onnxmlir/packages/container/onnx-mlir-dev) docker image for development.
4444

4545
## High level testing of ONNX-MLIR
4646

docs/docker-example/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM onnxmlir/onnx-mlir-dev
1+
FROM ghcr.io/onnxmlir/onnx-mlir-dev
22
WORKDIR /workdir
33
ENV HOME=/workdir
44

0 commit comments

Comments
 (0)