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

Turbo doesn't work in docker windowserver #8878

Closed
1 task done
zZHorizonZz opened this issue Jul 30, 2024 · 5 comments · Fixed by #9308
Closed
1 task done

Turbo doesn't work in docker windowserver #8878

zZHorizonZz opened this issue Jul 30, 2024 · 5 comments · Fixed by #9308
Labels
area: docs Improvements or additions to documentation

Comments

@zZHorizonZz
Copy link

Verify canary release

  • I verified that the issue exists in the latest Turborepo canary release.

Link to code that reproduces this issue

https://github.com/vercel/turbo

What package manager are you using / does the bug impact?

npm, Yarn v2/v3/v4 (node_modules linker only)

What operating system are you using?

Windows

Which canary version will you have in your reproduction?

v2.0.10-canary.2

Describe the Bug

I need to create a build for an application that works on multiple platforms, e.g., Linux and Windows. The Linux Docker build works fine, but when I try to create a similar build based on Windows Server, the Turbo CLI doesn't seem to work. It appears to run, but there is no output, and the exit code I get by running $LastExitCode is similar to -1073741515. What seems weird is that, Turbo works when installed on a standalone Windows Server.

I've tried executing the turbo.exe directly, but the behavior doesn't change, so the execution scripts (turbo.cmd, etc.) are working correctly. Which means that there is something wrong with the CLI itself. The only thing I can think of is that some dependencies might be missing, dependencies that come bundled with Windows or a standalone Windows Server but not with Windows server docker images, but I have tried using different versions servercore and server, and nothing changes.

Expected Behavior

The turbo cli should work.

To Reproduce

Try building this image for windows platform:

FROM mcr.microsoft.com/windows/servercore:ltsc2022 AS base

SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]

# PATH isn't actually set in the Docker image, so we have to set it from within the container
RUN $newPath = ('C:\nodejs;{0}\Yarn\bin;{1}' -f $env:LOCALAPPDATA, $env:PATH); \
	Write-Host ('Updating PATH: {0}' -f $newPath); \
	[Environment]::SetEnvironmentVariable('PATH', $newPath, [EnvironmentVariableTarget]::Machine)
# doing this first to share cache across versions more aggressively

ENV NODE_VERSION 21.7.3
ENV NODE_SHA256 d2314f496782b53ad2fe5fa82fca6ff7f39f07fe59dd007116404ad92179c78e

RUN $url = ('https://nodejs.org/dist/v{0}/node-v{0}-win-x64.zip' -f $env:NODE_VERSION); \
	Write-Host ('Downloading {0} ...' -f $url); \
	Invoke-WebRequest -Uri $url -OutFile 'node.zip'; \
	\
	Write-Host ('Verifying sha256 ({0}) ...' -f $env:NODE_SHA256); \
	if ((Get-FileHash node.zip -Algorithm sha256).Hash -ne $env:NODE_SHA256) { throw 'SHA256 mismatch' }; \
	\
	Write-Host 'Expanding ...'; \
	Expand-Archive node.zip -DestinationPath C:\; \
	\
	Write-Host 'Renaming ...'; \
	Rename-Item -Path ('C:\node-v{0}-win-x64' -f $env:NODE_VERSION) -NewName 'C:\nodejs'; \
	\
	Write-Host 'Removing ...'; \
	Remove-Item node.zip -Force; \
	\
	Write-Host 'Verifying ("node --version") ...'; \
	node --version; \
	Write-Host 'Verifying ("npm --version") ...'; \
	npm --version; \
	\
	Write-Host 'Complete.'

ENV YARN_VERSION 1.22.21

# "It is recommended to install Yarn through the npm package manager" (https://classic.yarnpkg.com/en/docs/install)
RUN Write-Host 'Installing "yarn" ...'; \
	npm install --global ('yarn@{0}' -f $env:YARN_VERSION); \
	\
	Write-Host 'Verifying ("yarn --version") ...'; \
	yarn --version; \
	\
	Write-Host 'Complete.'

CMD [ "node" ]

FROM base AS builder

# Set working directory
WORKDIR /app

COPY . .

RUN yarn global add turbo
RUN yarn global add @redocly/cli

CMD [ "powershell", "-Command", "while ($true) { Write-Host 'Still running...'; Start-Sleep -Seconds 3000; }" ]

And the executing the powershell -Command turbo; $LastExitCode in exec of the container.

Additional context

I have tested this agains multiple version ranging from 1.7.0 to most latest and also canary builds.

@zZHorizonZz zZHorizonZz added kind: bug Something isn't working needs: triage New issues get this label. Remove it after triage owned-by: turborepo labels Jul 30, 2024
@chris-olszewski
Copy link
Member

Looking up the exit code it looks like there's a DLL missing from the image that turbo requires to function.

I quick checked the required DLLs and this is what I came away with:

    KERNEL32.dll
    api-ms-win-crt-convert-l1-1-0.dll
    api-ms-win-crt-environment-l1-1-0.dll
    api-ms-win-crt-filesystem-l1-1-0.dll
    api-ms-win-crt-heap-l1-1-0.dll
    api-ms-win-crt-locale-l1-1-0.dll
    api-ms-win-crt-math-l1-1-0.dll
    api-ms-win-crt-private-l1-1-0.dll
    api-ms-win-crt-runtime-l1-1-0.dll
    api-ms-win-crt-stdio-l1-1-0.dll
    api-ms-win-crt-string-l1-1-0.dll
    api-ms-win-crt-time-l1-1-0.dll
    advapi32.dll
    bcrypt.dll
    crypt32.dll
    iphlpapi.dll
    kernel32.dll
    netapi32.dll
    ntdll.dll
    ole32.dll
    oleaut32.dll
    pdh.dll
    powrprof.dll
    psapi.dll
    secur32.dll
    shell32.dll
    shlwapi.dll
    user32.dll
    userenv.dll
    ws2_32.dll

@chris-olszewski chris-olszewski removed the needs: triage New issues get this label. Remove it after triage label Aug 28, 2024
@zZHorizonZz
Copy link
Author

I have checked dlls included with server core page:

    KERNEL32.dll [AVAILABLE??? There is duplicate or is this file different from lowercase version?]
    api-ms-win-crt-convert-l1-1-0.dll [NOT AVAILABLE]
    api-ms-win-crt-environment-l1-1-0.dll [NOT AVAILABLE]
    api-ms-win-crt-filesystem-l1-1-0.dll [NOT AVAILABLE]
    api-ms-win-crt-heap-l1-1-0.dll [NOT AVAILABLE]
    api-ms-win-crt-locale-l1-1-0.dll [NOT AVAILABLE]
    api-ms-win-crt-math-l1-1-0.dll [NOT AVAILABLE]
    api-ms-win-crt-private-l1-1-0.dll [NOT AVAILABLE]
    api-ms-win-crt-runtime-l1-1-0.dll [NOT AVAILABLE]
    api-ms-win-crt-stdio-l1-1-0.dll [NOT AVAILABLE]
    api-ms-win-crt-string-l1-1-0.dll [NOT AVAILABLE]
    api-ms-win-crt-time-l1-1-0.dll [NOT AVAILABLE]
    advapi32.dll [NOT AVAILABLE]
    bcrypt.dll [NOT AVAILABLE]
    crypt32.dll [AVAILABLE]
    iphlpapi.dll [AVAILABLE]
    kernel32.dll [AVAILABLE]
    netapi32.dll [AVAILABLE]
    ntdll.dll [AVAILABLE]
    ole32.dll  [AVAILABLE]
    oleaut32.dll [AVAILABLE]
    pdh.dll [AVAILABLE]
    powrprof.dll [AVAILABLE]
    psapi.dll [AVAILABLE]
    secur32.dll [AVAILABLE]
    shell32.dll [AVAILABLE]
    shlwapi.dll [AVAILABLE]
    user32.dll [AVAILABLE]
    userenv.dll [AVAILABLE]
    ws2_32.dll [AVAILABLE]

Note that these are DLLs listed for old versions of Windows, as that page was updated in 2017. I will try inquiring with the windows container team about this and get their opinion on it.

@zZHorizonZz
Copy link
Author

So I did a little bit of research and found out that api-ms-win-crt- are DLLs provided by the VC redistributable. So I tried using this, and it seems to work. Are there any listed requirements on the Turbo site for Windows? As I didn't know that these were required.

@organom
Copy link

organom commented Oct 14, 2024

Snippet on the installation of the vc_redist_x64 that worked for me in servercore, in order to get turborepo (2.1.1) running (download url taken from https://learn.microsoft.com/en-us/cpp/windows/latest-supported-vc-redist?view=msvc-170)

Please note: Installation doesn't seem to work on nanoserver.

Cmd version:

SHELL ["cmd", "/S", "/C"]

ADD https://aka.ms/vs/17/release/vc_redist.x64.exe C:/temp/vcredist_x64.exe
RUN C:/temp/vcredist_x64.exe /install /passive /norestart /log C:/temp/vcredist_log.txt

Powershell version:

SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]

ADD https://aka.ms/vs/17/release/vc_redist.x64.exe c:/temp/vcredist_x64.exe
RUN Start-Process -filepath C:/temp/vcredist_x64.exe -ArgumentList "/install", "/passive", "/norestart", "'/log c:/temp/vcredist_log.txt'" -PassThru | wait-process

Hope it helps others, and thank you for this issue, it really helped pinpointing the issue.

@chris-olszewski chris-olszewski added area: docs Improvements or additions to documentation and removed kind: bug Something isn't working labels Oct 22, 2024
@chris-olszewski
Copy link
Member

#9308 adds documentation that the Microsoft C Runtime Libraries are required for turbo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: docs Improvements or additions to documentation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants