From cca043f686b427e2b09a5e43d948bf08474194e5 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 6 Nov 2025 20:59:44 +0000 Subject: [PATCH 01/12] Initial plan From 7e91fb6724100078d28e7406aae44e6938efb5a8 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 6 Nov 2025 21:02:21 +0000 Subject: [PATCH 02/12] Add Python to Linux and Windows Dockerfiles with verification test Co-authored-by: hawkeyexl <5209367+hawkeyexl@users.noreply.github.com> --- linux.Dockerfile | 1 + test/pythonVersion.test.js | 71 ++++++++++++++++++++++++++++++++++++++ windows.Dockerfile | 19 ++++++++++ 3 files changed, 91 insertions(+) create mode 100644 test/pythonVersion.test.js diff --git a/linux.Dockerfile b/linux.Dockerfile index 6ae53f3..7854df0 100644 --- a/linux.Dockerfile +++ b/linux.Dockerfile @@ -26,6 +26,7 @@ RUN apt update \ libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 \ libxtst6 ffmpeg wget xdg-utils \ default-jre \ + python3 python3-pip python3-venv \ && update-ca-certificates \ && apt autoclean -y \ && apt autoremove -y \ diff --git a/test/pythonVersion.test.js b/test/pythonVersion.test.js new file mode 100644 index 0000000..a19c471 --- /dev/null +++ b/test/pythonVersion.test.js @@ -0,0 +1,71 @@ +const { exec } = require("child_process"); +const assert = require("assert").strict; + +// Parse command line arguments +const args = process.argv.slice(2); +const versionArg = args.find(arg => arg.startsWith('--version=') || arg.startsWith('-v=')); +const version = versionArg ? versionArg.split('=')[1] : 'latest'; + +let os; +if (process.platform === "win32") { + os = "windows"; +} else { + os = "linux"; +} + +// Test Python version command +describe("Python is installed", function () { + // Set indefinite timeout for Docker operations + this.timeout(0); + + it("python --version returns valid output", async () => { + return new Promise((resolve, reject) => { + let pythonVersionCmd; + if (os === "linux") { + pythonVersionCmd = `docker run --rm --entrypoint "" docdetective/docdetective:${version}-${os} python3 --version`; + } else { + pythonVersionCmd = `docker run --rm --entrypoint cmd.exe docdetective/docdetective:${version}-${os} /c "python --version"`; + } + + console.log(`Running: ${pythonVersionCmd}`); + + const pythonVersion = exec(pythonVersionCmd); + + let stdout = ""; + let stderr = ""; + + pythonVersion.stdout.on("data", (data) => { + stdout += data; + console.log(`stdout: ${data}`); + }); + + pythonVersion.stderr.on("data", (data) => { + stderr += data; + console.error(`stderr: ${data}`); + }); + + pythonVersion.on("error", (error) => { + console.error(`Error: ${error.message}`); + reject(error); + }); + + pythonVersion.on("close", (code) => { + console.log(`Child process exited with code ${code}`); + if (code !== 0) { + reject(new Error(`Docker process exited with code ${code}. stderr: ${stderr}`)); + } else { + // Verify that output contains "Python" and a version number + const trimmedStdout = stdout.trim(); + const trimmedStderr = stderr.trim(); + + if (trimmedStdout.includes("Python 3.") || trimmedStderr.includes("Python 3.")) { + console.log("Python 3.x confirmed"); + resolve(); + } else { + reject(new Error(`Version output does not contain expected "Python 3.". stdout: ${trimmedStdout}, stderr: ${trimmedStderr}`)); + } + } + }); + }); + }); +}); diff --git a/windows.Dockerfile b/windows.Dockerfile index ac151f3..e798893 100644 --- a/windows.Dockerfile +++ b/windows.Dockerfile @@ -93,6 +93,25 @@ RUN $env:Path = 'C:\dita-ot\bin;' + $env:Path; \ Write-Host 'DITA-OT installed. Verifying...'; \ dita --version +# Download and install Python +RUN $PythonVersion = '3.13.1'; \ + $PythonUrl = 'https://www.python.org/ftp/python/' + $PythonVersion + '/python-' + $PythonVersion + '-amd64.exe'; \ + $PythonInstaller = 'C:\python-installer.exe'; \ + Write-Host 'Downloading Python...'; \ + [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; \ + Invoke-WebRequest -Uri $PythonUrl -OutFile $PythonInstaller -UseBasicParsing; \ + Write-Host 'Installing Python...'; \ + Start-Process -FilePath $PythonInstaller -ArgumentList '/quiet', 'InstallAllUsers=1', 'PrependPath=1', 'Include_test=0' -Wait; \ + Write-Host 'Python installation completed'; \ + Remove-Item -Path $PythonInstaller -Force + +# Add Python to PATH and verify installation +RUN $env:Path = 'C:\Program Files\Python313;C:\Program Files\Python313\Scripts;' + $env:Path; \ + [Environment]::SetEnvironmentVariable('Path', $env:Path, [System.EnvironmentVariableTarget]::Machine); \ + Write-Host 'Verifying Python installation...'; \ + python --version; \ + pip --version + # Create app directory WORKDIR /app From d694145aedd177b223b948ae0ebc500729377eea Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 6 Nov 2025 21:05:57 +0000 Subject: [PATCH 03/12] Update README to document Python inclusion Co-authored-by: hawkeyexl <5209367+hawkeyexl@users.noreply.github.com> --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index ccddd76..840ba70 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,7 @@ The official Docker image for Doc Detective, a documentation testing framework t ## Features - Pre-installed with Node.js and Doc Detective +- Includes Python 3 for Python-based testing and automation - Includes Google Chrome and Firefox for browser-based tests - Includes DITA Open Toolkit (DITA-OT) for DITA content transformation - Optimized for CI/CD pipelines and containerized environments From 3bbf9c23a638501c87b238188839f98f00a77a9d Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 6 Nov 2025 21:07:25 +0000 Subject: [PATCH 04/12] Make Python path version-agnostic in Windows Dockerfile Co-authored-by: hawkeyexl <5209367+hawkeyexl@users.noreply.github.com> --- windows.Dockerfile | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/windows.Dockerfile b/windows.Dockerfile index e798893..185561b 100644 --- a/windows.Dockerfile +++ b/windows.Dockerfile @@ -95,6 +95,7 @@ RUN $env:Path = 'C:\dita-ot\bin;' + $env:Path; \ # Download and install Python RUN $PythonVersion = '3.13.1'; \ + $PythonMajorMinor = ($PythonVersion -split '\.')[0..1] -join ''; \ $PythonUrl = 'https://www.python.org/ftp/python/' + $PythonVersion + '/python-' + $PythonVersion + '-amd64.exe'; \ $PythonInstaller = 'C:\python-installer.exe'; \ Write-Host 'Downloading Python...'; \ @@ -103,10 +104,13 @@ RUN $PythonVersion = '3.13.1'; \ Write-Host 'Installing Python...'; \ Start-Process -FilePath $PythonInstaller -ArgumentList '/quiet', 'InstallAllUsers=1', 'PrependPath=1', 'Include_test=0' -Wait; \ Write-Host 'Python installation completed'; \ - Remove-Item -Path $PythonInstaller -Force + Remove-Item -Path $PythonInstaller -Force; \ + [Environment]::SetEnvironmentVariable('PYTHON_VERSION', $PythonVersion, [System.EnvironmentVariableTarget]::Machine); \ + [Environment]::SetEnvironmentVariable('PYTHON_MAJOR_MINOR', $PythonMajorMinor, [System.EnvironmentVariableTarget]::Machine) # Add Python to PATH and verify installation -RUN $env:Path = 'C:\Program Files\Python313;C:\Program Files\Python313\Scripts;' + $env:Path; \ +RUN $PythonMajorMinor = [Environment]::GetEnvironmentVariable('PYTHON_MAJOR_MINOR', [System.EnvironmentVariableTarget]::Machine); \ + $env:Path = "C:\Program Files\Python$PythonMajorMinor;C:\Program Files\Python$PythonMajorMinor\Scripts;" + $env:Path; \ [Environment]::SetEnvironmentVariable('Path', $env:Path, [System.EnvironmentVariableTarget]::Machine); \ Write-Host 'Verifying Python installation...'; \ python --version; \ From 43a52696b91b6966c75dcda90fdc4724d7910ac4 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 6 Nov 2025 21:08:40 +0000 Subject: [PATCH 05/12] Fix PrependPath setting and document version check flexibility Co-authored-by: hawkeyexl <5209367+hawkeyexl@users.noreply.github.com> --- test/pythonVersion.test.js | 4 ++++ windows.Dockerfile | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/test/pythonVersion.test.js b/test/pythonVersion.test.js index a19c471..e3302e7 100644 --- a/test/pythonVersion.test.js +++ b/test/pythonVersion.test.js @@ -55,6 +55,10 @@ describe("Python is installed", function () { reject(new Error(`Docker process exited with code ${code}. stderr: ${stderr}`)); } else { // Verify that output contains "Python" and a version number + // Note: We check for "Python 3." rather than specific versions because: + // - Linux uses Python from apt (currently 3.11.2) + // - Windows uses Python from official installer (currently 3.13.1) + // This flexible check ensures the test works across both platforms const trimmedStdout = stdout.trim(); const trimmedStderr = stderr.trim(); diff --git a/windows.Dockerfile b/windows.Dockerfile index 185561b..bd43adf 100644 --- a/windows.Dockerfile +++ b/windows.Dockerfile @@ -102,7 +102,7 @@ RUN $PythonVersion = '3.13.1'; \ [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; \ Invoke-WebRequest -Uri $PythonUrl -OutFile $PythonInstaller -UseBasicParsing; \ Write-Host 'Installing Python...'; \ - Start-Process -FilePath $PythonInstaller -ArgumentList '/quiet', 'InstallAllUsers=1', 'PrependPath=1', 'Include_test=0' -Wait; \ + Start-Process -FilePath $PythonInstaller -ArgumentList '/quiet', 'InstallAllUsers=1', 'PrependPath=0', 'Include_test=0' -Wait; \ Write-Host 'Python installation completed'; \ Remove-Item -Path $PythonInstaller -Force; \ [Environment]::SetEnvironmentVariable('PYTHON_VERSION', $PythonVersion, [System.EnvironmentVariableTarget]::Machine); \ From 50b19103e6bf53dd6752af668f5e22b73bffb7a9 Mon Sep 17 00:00:00 2001 From: hawkeyexl Date: Thu, 6 Nov 2025 16:23:04 -0500 Subject: [PATCH 06/12] Bundle version checks into the build process --- linux.Dockerfile | 7 ++++ test/ditaVersion.test.js | 71 ------------------------------------ test/pythonVersion.test.js | 75 -------------------------------------- 3 files changed, 7 insertions(+), 146 deletions(-) delete mode 100644 test/ditaVersion.test.js delete mode 100644 test/pythonVersion.test.js diff --git a/linux.Dockerfile b/linux.Dockerfile index 7854df0..2512707 100644 --- a/linux.Dockerfile +++ b/linux.Dockerfile @@ -45,6 +45,13 @@ RUN curl -kL https://github.com/dita-ot/dita-ot/releases/download/${DITA_OT_VERS # Add DITA-OT to PATH ENV PATH="/opt/dita-ot/bin:${PATH}" +# Check versions of installed packages +RUN node -v \ + && npm -v \ + && java -version \ + && python3 --version \ + && dita --version + # Create app directory WORKDIR /app diff --git a/test/ditaVersion.test.js b/test/ditaVersion.test.js deleted file mode 100644 index f04b370..0000000 --- a/test/ditaVersion.test.js +++ /dev/null @@ -1,71 +0,0 @@ -const { exec } = require("child_process"); -const assert = require("assert").strict; - -// Parse command line arguments -const args = process.argv.slice(2); -const versionArg = args.find(arg => arg.startsWith('--version=') || arg.startsWith('-v=')); -const version = versionArg ? versionArg.split('=')[1] : 'latest'; - -let os; -if (process.platform === "win32") { - os = "windows"; -} else { - os = "linux"; -} - -// Test DITA-OT version command -describe("DITA-OT is installed", function () { - // Set indefinite timeout for Docker operations - this.timeout(0); - - it("dita --version returns valid output", async () => { - return new Promise((resolve, reject) => { - let ditaVersionCmd; - if (os === "linux") { - ditaVersionCmd = `docker run --rm --entrypoint "" docdetective/docdetective:${version}-${os} dita --version`; - } else { - ditaVersionCmd = `docker run --rm --entrypoint cmd.exe docdetective/docdetective:${version}-${os} /c "dita --version"`; - } - - console.log(`Running: ${ditaVersionCmd}`); - - const ditaVersion = exec(ditaVersionCmd); - - let stdout = ""; - let stderr = ""; - - ditaVersion.stdout.on("data", (data) => { - stdout += data; - console.log(`stdout: ${data}`); - }); - - ditaVersion.stderr.on("data", (data) => { - stderr += data; - console.error(`stderr: ${data}`); - }); - - ditaVersion.on("error", (error) => { - console.error(`Error: ${error.message}`); - reject(error); - }); - - ditaVersion.on("close", (code) => { - console.log(`Child process exited with code ${code}`); - if (code !== 0) { - reject(new Error(`Docker process exited with code ${code}. stderr: ${stderr}`)); - } else { - // Verify that output contains the exact DITA-OT version 4.3.4 - const trimmedStdout = stdout.trim(); - const trimmedStderr = stderr.trim(); - - if (trimmedStdout.includes("4.3.4") || trimmedStderr.includes("4.3.4")) { - console.log("DITA-OT version 4.3.4 confirmed"); - resolve(); - } else { - reject(new Error(`Version output does not contain expected version "4.3.4". stdout: ${trimmedStdout}, stderr: ${trimmedStderr}`)); - } - } - }); - }); - }); -}); diff --git a/test/pythonVersion.test.js b/test/pythonVersion.test.js deleted file mode 100644 index e3302e7..0000000 --- a/test/pythonVersion.test.js +++ /dev/null @@ -1,75 +0,0 @@ -const { exec } = require("child_process"); -const assert = require("assert").strict; - -// Parse command line arguments -const args = process.argv.slice(2); -const versionArg = args.find(arg => arg.startsWith('--version=') || arg.startsWith('-v=')); -const version = versionArg ? versionArg.split('=')[1] : 'latest'; - -let os; -if (process.platform === "win32") { - os = "windows"; -} else { - os = "linux"; -} - -// Test Python version command -describe("Python is installed", function () { - // Set indefinite timeout for Docker operations - this.timeout(0); - - it("python --version returns valid output", async () => { - return new Promise((resolve, reject) => { - let pythonVersionCmd; - if (os === "linux") { - pythonVersionCmd = `docker run --rm --entrypoint "" docdetective/docdetective:${version}-${os} python3 --version`; - } else { - pythonVersionCmd = `docker run --rm --entrypoint cmd.exe docdetective/docdetective:${version}-${os} /c "python --version"`; - } - - console.log(`Running: ${pythonVersionCmd}`); - - const pythonVersion = exec(pythonVersionCmd); - - let stdout = ""; - let stderr = ""; - - pythonVersion.stdout.on("data", (data) => { - stdout += data; - console.log(`stdout: ${data}`); - }); - - pythonVersion.stderr.on("data", (data) => { - stderr += data; - console.error(`stderr: ${data}`); - }); - - pythonVersion.on("error", (error) => { - console.error(`Error: ${error.message}`); - reject(error); - }); - - pythonVersion.on("close", (code) => { - console.log(`Child process exited with code ${code}`); - if (code !== 0) { - reject(new Error(`Docker process exited with code ${code}. stderr: ${stderr}`)); - } else { - // Verify that output contains "Python" and a version number - // Note: We check for "Python 3." rather than specific versions because: - // - Linux uses Python from apt (currently 3.11.2) - // - Windows uses Python from official installer (currently 3.13.1) - // This flexible check ensures the test works across both platforms - const trimmedStdout = stdout.trim(); - const trimmedStderr = stderr.trim(); - - if (trimmedStdout.includes("Python 3.") || trimmedStderr.includes("Python 3.")) { - console.log("Python 3.x confirmed"); - resolve(); - } else { - reject(new Error(`Version output does not contain expected "Python 3.". stdout: ${trimmedStdout}, stderr: ${trimmedStderr}`)); - } - } - }); - }); - }); -}); From 1690fb0a15755d773975fa9d17f0212223bff5bc Mon Sep 17 00:00:00 2001 From: hawkeyexl Date: Thu, 6 Nov 2025 16:26:05 -0500 Subject: [PATCH 07/12] Update readme --- README.md | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 840ba70..373b951 100644 --- a/README.md +++ b/README.md @@ -9,14 +9,17 @@ The official Docker image for Doc Detective, a documentation testing framework t ## Features -- Pre-installed with Node.js and Doc Detective -- Includes Python 3 for Python-based testing and automation +- Pre-installed with + - Doc Detective + - Node.js + - Python 3 + - Java Runtime Environment (JRE) + - DITA Open Toolkit (DITA-OT) - Includes Google Chrome and Firefox for browser-based tests -- Includes DITA Open Toolkit (DITA-OT) for DITA content transformation - Optimized for CI/CD pipelines and containerized environments - Simple volume mounting for working with your local test files -> **Note:** This image runs Doc Detective in a headless mode and isn't compatible with the `record` step. If you need to record test runs, use the [Doc Detective CLI](https://github.com/doc-detective/doc-detective) directly in your local environment. +> **Note:** This image runs Doc Detective in a headless mode and isn't compatible with the `record` step. If you need to record test runs, use the [Doc Detective CLI](https://github.com/doc-detective/doc-detective) directly in your local or CI/CD environment. ## Usage From c38b6fa4b7fc32bbc4ba66c2e755d07f135cb730 Mon Sep 17 00:00:00 2001 From: hawkeyexl Date: Thu, 6 Nov 2025 16:26:41 -0500 Subject: [PATCH 08/12] Check pip version --- linux.Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/linux.Dockerfile b/linux.Dockerfile index 2512707..4244f80 100644 --- a/linux.Dockerfile +++ b/linux.Dockerfile @@ -50,6 +50,7 @@ RUN node -v \ && npm -v \ && java -version \ && python3 --version \ + && pip3 --version \ && dita --version # Create app directory From a29124606d4ec2e90e09f201f84407efd9f9f623 Mon Sep 17 00:00:00 2001 From: hawkeyexl Date: Thu, 6 Nov 2025 16:47:56 -0500 Subject: [PATCH 09/12] Fix quotes --- windows.Dockerfile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/windows.Dockerfile b/windows.Dockerfile index bd43adf..ef0cb31 100644 --- a/windows.Dockerfile +++ b/windows.Dockerfile @@ -110,7 +110,9 @@ RUN $PythonVersion = '3.13.1'; \ # Add Python to PATH and verify installation RUN $PythonMajorMinor = [Environment]::GetEnvironmentVariable('PYTHON_MAJOR_MINOR', [System.EnvironmentVariableTarget]::Machine); \ - $env:Path = "C:\Program Files\Python$PythonMajorMinor;C:\Program Files\Python$PythonMajorMinor\Scripts;" + $env:Path; \ + $PythonPath = "C:\Program Files\Python$PythonMajorMinor"; \ + $PythonScriptsPath = "C:\Program Files\Python$PythonMajorMinor\Scripts"; \ + $env:Path = "$PythonPath;$PythonScriptsPath;" + $env:Path; \ [Environment]::SetEnvironmentVariable('Path', $env:Path, [System.EnvironmentVariableTarget]::Machine); \ Write-Host 'Verifying Python installation...'; \ python --version; \ From 6228a993cf240447719d9ce4b1f8ba5e07cb6e77 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 7 Nov 2025 00:46:25 +0000 Subject: [PATCH 10/12] Fix Windows build: recalculate Python version in PATH setup layer Co-authored-by: hawkeyexl <5209367+hawkeyexl@users.noreply.github.com> --- windows.Dockerfile | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/windows.Dockerfile b/windows.Dockerfile index ef0cb31..bfbc9ae 100644 --- a/windows.Dockerfile +++ b/windows.Dockerfile @@ -104,12 +104,11 @@ RUN $PythonVersion = '3.13.1'; \ Write-Host 'Installing Python...'; \ Start-Process -FilePath $PythonInstaller -ArgumentList '/quiet', 'InstallAllUsers=1', 'PrependPath=0', 'Include_test=0' -Wait; \ Write-Host 'Python installation completed'; \ - Remove-Item -Path $PythonInstaller -Force; \ - [Environment]::SetEnvironmentVariable('PYTHON_VERSION', $PythonVersion, [System.EnvironmentVariableTarget]::Machine); \ - [Environment]::SetEnvironmentVariable('PYTHON_MAJOR_MINOR', $PythonMajorMinor, [System.EnvironmentVariableTarget]::Machine) + Remove-Item -Path $PythonInstaller -Force # Add Python to PATH and verify installation -RUN $PythonMajorMinor = [Environment]::GetEnvironmentVariable('PYTHON_MAJOR_MINOR', [System.EnvironmentVariableTarget]::Machine); \ +RUN $PythonVersion = '3.13.1'; \ + $PythonMajorMinor = ($PythonVersion -split '\.')[0..1] -join ''; \ $PythonPath = "C:\Program Files\Python$PythonMajorMinor"; \ $PythonScriptsPath = "C:\Program Files\Python$PythonMajorMinor\Scripts"; \ $env:Path = "$PythonPath;$PythonScriptsPath;" + $env:Path; \ From 5f4bc8f686cc90ce2bf9c76d084f17a89e86b45f Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 7 Nov 2025 00:48:24 +0000 Subject: [PATCH 11/12] Use ARG for Python version to eliminate duplication Co-authored-by: hawkeyexl <5209367+hawkeyexl@users.noreply.github.com> --- windows.Dockerfile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/windows.Dockerfile b/windows.Dockerfile index bfbc9ae..bd69912 100644 --- a/windows.Dockerfile +++ b/windows.Dockerfile @@ -1,5 +1,6 @@ FROM mcr.microsoft.com/windows/server:ltsc2022 AS system ARG PACKAGE_VERSION=latest +ARG PYTHON_VERSION=3.13.1 LABEL authors="Doc Detective" \ description="The official Docker image for Doc Detective. Keep your docs accurate with ease." \ @@ -94,7 +95,7 @@ RUN $env:Path = 'C:\dita-ot\bin;' + $env:Path; \ dita --version # Download and install Python -RUN $PythonVersion = '3.13.1'; \ +RUN $PythonVersion = $env:PYTHON_VERSION; \ $PythonMajorMinor = ($PythonVersion -split '\.')[0..1] -join ''; \ $PythonUrl = 'https://www.python.org/ftp/python/' + $PythonVersion + '/python-' + $PythonVersion + '-amd64.exe'; \ $PythonInstaller = 'C:\python-installer.exe'; \ @@ -107,7 +108,7 @@ RUN $PythonVersion = '3.13.1'; \ Remove-Item -Path $PythonInstaller -Force # Add Python to PATH and verify installation -RUN $PythonVersion = '3.13.1'; \ +RUN $PythonVersion = $env:PYTHON_VERSION; \ $PythonMajorMinor = ($PythonVersion -split '\.')[0..1] -join ''; \ $PythonPath = "C:\Program Files\Python$PythonMajorMinor"; \ $PythonScriptsPath = "C:\Program Files\Python$PythonMajorMinor\Scripts"; \ From e9ebd4746747ed5bc853573aebf264c724fbbd4f Mon Sep 17 00:00:00 2001 From: hawkeyexl Date: Thu, 6 Nov 2025 17:20:38 -0800 Subject: [PATCH 12/12] Windows build fixes --- windows.Dockerfile | 52 +++++++++++++++++++++++----------------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/windows.Dockerfile b/windows.Dockerfile index bd69912..fb0bd2f 100644 --- a/windows.Dockerfile +++ b/windows.Dockerfile @@ -48,9 +48,29 @@ RUN $env:Path = 'C:\Program Files\nodejs;' + $env:Path; \ npm -v; \ npm install -g npm@latest -# Install Doc Detective from NPM -RUN Set-ExecutionPolicy Bypass -Scope Process -Force; \ - npm install -g doc-detective@$env:PACKAGE_VERSION + # Download and install Python +RUN $PythonVersion = $env:PYTHON_VERSION; \ + $PythonMajorMinor = ($PythonVersion -split '\.')[0..1] -join ''; \ + $PythonUrl = 'https://www.python.org/ftp/python/' + $PythonVersion + '/python-' + $PythonVersion + '-amd64.exe'; \ + $PythonInstaller = 'C:\python-installer.exe'; \ + Write-Host 'Downloading Python...'; \ + [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; \ + Invoke-WebRequest -Uri $PythonUrl -OutFile $PythonInstaller -UseBasicParsing; \ + Write-Host 'Installing Python...'; \ + Start-Process -FilePath $PythonInstaller -ArgumentList '/quiet', 'InstallAllUsers=1', 'PrependPath=0', 'Include_test=0' -Wait; \ + Write-Host 'Python installation completed'; \ + Remove-Item -Path $PythonInstaller -Force + +# Add Python to PATH and verify installation +RUN $PythonVersion = $env:PYTHON_VERSION; \ + $PythonMajorMinor = ($PythonVersion -split '\.')[0..1] -join ''; \ + $PythonPath = 'C:\Program Files\Python' + $PythonMajorMinor; \ + $PythonScriptsPath = 'C:\Program Files\Python' + $PythonMajorMinor + '\Scripts'; \ + $env:Path = $PythonPath + ';' + $PythonScriptsPath + ';' + $env:Path; \ + [Environment]::SetEnvironmentVariable('Path', $env:Path, [System.EnvironmentVariableTarget]::Machine); \ + Write-Host 'Verifying Python installation...'; \ + python --version; \ + pip --version; # Download and install Microsoft OpenJDK 17 RUN $JavaVersion = '17.0.14'; \ @@ -94,29 +114,9 @@ RUN $env:Path = 'C:\dita-ot\bin;' + $env:Path; \ Write-Host 'DITA-OT installed. Verifying...'; \ dita --version -# Download and install Python -RUN $PythonVersion = $env:PYTHON_VERSION; \ - $PythonMajorMinor = ($PythonVersion -split '\.')[0..1] -join ''; \ - $PythonUrl = 'https://www.python.org/ftp/python/' + $PythonVersion + '/python-' + $PythonVersion + '-amd64.exe'; \ - $PythonInstaller = 'C:\python-installer.exe'; \ - Write-Host 'Downloading Python...'; \ - [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; \ - Invoke-WebRequest -Uri $PythonUrl -OutFile $PythonInstaller -UseBasicParsing; \ - Write-Host 'Installing Python...'; \ - Start-Process -FilePath $PythonInstaller -ArgumentList '/quiet', 'InstallAllUsers=1', 'PrependPath=0', 'Include_test=0' -Wait; \ - Write-Host 'Python installation completed'; \ - Remove-Item -Path $PythonInstaller -Force - -# Add Python to PATH and verify installation -RUN $PythonVersion = $env:PYTHON_VERSION; \ - $PythonMajorMinor = ($PythonVersion -split '\.')[0..1] -join ''; \ - $PythonPath = "C:\Program Files\Python$PythonMajorMinor"; \ - $PythonScriptsPath = "C:\Program Files\Python$PythonMajorMinor\Scripts"; \ - $env:Path = "$PythonPath;$PythonScriptsPath;" + $env:Path; \ - [Environment]::SetEnvironmentVariable('Path', $env:Path, [System.EnvironmentVariableTarget]::Machine); \ - Write-Host 'Verifying Python installation...'; \ - python --version; \ - pip --version +# Install Doc Detective from NPM +RUN Set-ExecutionPolicy Bypass -Scope Process -Force; \ + npm install -g doc-detective@$env:PACKAGE_VERSION # Create app directory WORKDIR /app