Skip to content

Commit

Permalink
Merge pull request #57 from secretflow/xc/release
Browse files Browse the repository at this point in the history
Tweak script to handle aarch64 only dockerfiles
  • Loading branch information
6fj authored Dec 11, 2023
2 parents b038fce + b177356 commit a56f3ae
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 6 deletions.
1 change: 1 addition & 0 deletions dockerfiles/release-ci-aarch64.DockerFile
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Conda does not support CentOS 7 on Linux aarch64, so use CentOS 8
FROM centos:centos8

RUN cd /etc/yum.repos.d/ \
Expand Down
2 changes: 1 addition & 1 deletion dockerfiles/release-ci.DockerFile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM centos:centos7
FROM centos:centos7

RUN yum install -y centos-release-scl epel-release \
&& yum update -y \
Expand Down
21 changes: 16 additions & 5 deletions publish_docker_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ def _check_is_multiarch_dockerfile(file):
else:
return False

def _check_is_aarch64_dockerfile(file):
if 'aarch64' in file:
return True
return False


COLOR_GREEN = "\033[92m"
COLOR_END = "\033[0m"
Expand Down Expand Up @@ -72,9 +77,15 @@ def main():

print(f"{COLOR_GREEN}Build docker image {name}{COLOR_END}")

if _check_is_multiarch_dockerfile(dockerfile):
is_multi_arch = _check_is_multiarch_dockerfile(dockerfile)
is_aarch64 = _check_is_aarch64_dockerfile(dockerfile)

if is_multi_arch or is_aarch64:
if is_multi_arch:
arch_str = "linux/amd64,linux/arm64"
elif is_aarch64:
arch_str = "linux/arm64"
print(f"{COLOR_GREEN}Creating buildx")
is_multi_arch = True
_run_shell_command_with_live_output(
[
"docker",
Expand All @@ -83,7 +94,7 @@ def main():
"--name",
"sf-image-builder",
"--platform",
"linux/amd64,linux/arm64",
arch_str,
"--use",
],
".",
Expand All @@ -96,7 +107,7 @@ def main():
"buildx",
"build",
"--platform",
"linux/amd64,linux/arm64",
arch_str,
"--no-cache",
".",
"-f",
Expand All @@ -114,7 +125,7 @@ def main():
"buildx",
"build",
"--platform",
"linux/amd64,linux/arm64",
arch_str,
".",
"-f",
dockerfile,
Expand Down

0 comments on commit a56f3ae

Please sign in to comment.