Skip to content
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 doc/changelog.d/1785.fixed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
docker build process failing on helper script
19 changes: 11 additions & 8 deletions docker/build_docker_windows.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,16 @@
import urllib.request

# First, get all environment variables that start with AWP_ROOT
awp_root = {}
awp_root: dict[int, str] = {}
for env_key, env_val in os.environ.items():
if env_key.startswith("AWP_ROOT"):
# There is an Ansys installation... Check that the version is at
# least 2024R1. Environment variables are in the form
# AWP_ROOT241=/path/to/2024R1
#
# Get the version number
version = env_key.split("AWP_ROOT")[1]
if version < "241":
version = int(env_key.split("AWP_ROOT")[1])
if version < 241:
# This version is too old, so we will ignore it
continue
else:
Expand Down Expand Up @@ -95,9 +95,9 @@
# Copy the Geometry Service files to the temporary directory
print(f">>> Copying Geometry Service files to temporary directory to {TMP_DIR}")
if backend_selection == 1:
BIN_DIR = TMP_DIR / "bins" / "DockerWindows" / "bin" / "x64" / "Release_Headless" / "net472"
BIN_DIR = TMP_DIR / "archive" / "bin" / "x64" / "Release_Headless" / "net472"
else:
BIN_DIR = TMP_DIR / "bins" / "DockerWindows" / "bin" / "x64" / "Release_Core_Windows" / "net8.0"
BIN_DIR = TMP_DIR / "archive" / "bin" / "x64" / "Release_Core_Windows" / "net8.0"

# Create the directory structure
shutil.copytree(
Expand All @@ -110,7 +110,7 @@
zip_file = shutil.make_archive(
"windows-dms-binaries" if backend_selection == 1 else "windows-core-binaries",
"zip",
root_dir=TMP_DIR / "bins",
root_dir=TMP_DIR / "archive",
)

# Move the ZIP file to the docker directory
Expand All @@ -119,7 +119,7 @@

# Remove the temporary directory
print(">>> Removing Geometry Service files")
shutil.rmtree(TMP_DIR / "bins")
shutil.rmtree(TMP_DIR / "archive")

# Download the Dockerfile from the repository
print(">>> Downloading Dockerfile")
Expand All @@ -146,12 +146,15 @@
line = dockerfile.find("ENV AWP_ROOT")
if line != -1:
# Get the environment variable name
env_var = dockerfile[line : LENGTH_NO_VER + line] + ANSYS_VER
env_var = f"{dockerfile[line : LENGTH_NO_VER + line]}{ANSYS_VER}"
# Replace the environment variable with the correct value
dockerfile = dockerfile.replace(
dockerfile[line : LENGTH_VER + line],
env_var,
)
# Write the updated Dockerfile
with Path.open(TMP_DIR / "Dockerfile", "w") as f:
f.write(dockerfile)
else:
print(
"XXXXXXX No AWP_ROOT environment variable found in Dockerfile.. exiting process. XXXXXXX" # noqa: E501
Expand Down
Loading