diff --git a/Sources/TaskCLI/Docker.swift b/Sources/TaskCLI/Docker.swift new file mode 100644 index 0000000..17362c6 --- /dev/null +++ b/Sources/TaskCLI/Docker.swift @@ -0,0 +1,9 @@ +struct Docker { + static func getLinuxPlatformStringWithHostArchitecture() -> String { + #if arch(x86_64) + return "linux/amd64" + #else + return "linux/arm64" + #endif + } +} \ No newline at end of file diff --git a/Sources/TaskCLI/GenerateDocumentation Command.swift b/Sources/TaskCLI/GenerateDocumentation Command.swift index 91a36c5..c7fdd83 100644 --- a/Sources/TaskCLI/GenerateDocumentation Command.swift +++ b/Sources/TaskCLI/GenerateDocumentation Command.swift @@ -46,7 +46,7 @@ struct GenerateDocumentationCommand: Script { try await docker( "run", "--rm", "-v", "\(tempDirectory.path):/code", - "--platform", "linux/arm64", + "--platform", Docker.getLinuxPlatformStringWithHostArchitecture(), "-w", "/code", "swift:latest", "/bin/bash", "-c", script, diff --git a/Sources/TaskCLI/Test Command.swift b/Sources/TaskCLI/Test Command.swift index c2cc229..28f74a7 100644 --- a/Sources/TaskCLI/Test Command.swift +++ b/Sources/TaskCLI/Test Command.swift @@ -26,7 +26,7 @@ struct TestCommand: Script { "run", "-v", "\(currentDirectory):/code", "--security-opt", "systempaths=unconfined", - "--platform", "linux/arm64", + "--platform", Docker.getLinuxPlatformStringWithHostArchitecture(), "-w", "/code", "swift:latest", "/bin/bash", "-c", "swift test --skip InotifyLimitTests; swift test --skip-build --filter InotifyLimitTests" )