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

Tweak script to handle aarch64 only dockerfiles #57

Merged
merged 1 commit into from
Dec 11, 2023
Merged
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
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
Loading