I’m trying to build Docker image on Windows 11 .
My Dockerfile is:
FROM mcr.microsoft.com/dotnet/sdk:8.0-windowsservercore-ltsc2022 as builder
COPY src/ ./src/
RUN dotnet build -c Release src/compute.sln
FROM mcr.microsoft.com/windows/server:ltsc2022
RUN curl -fSLo dotnet-framework-installer.exe https://download.visualstudio.microsoft.com/download/pr/7afca223-55d2-470a-8edc-6a1739ae3252/abd170b4b0ec15ad0222a809b761a036/ndp48-x86-x64-allos-enu.exe `
&& .\dotnet-framework-installer.exe /q `
&& del .\dotnet-framework-installer.exe `
&& powershell Remove-Item -Force -Recurse ${Env:TEMP}\*
RUN curl -fSLo rhino_installer.exe https://www.rhino3d.com/download/rhino-for-windows/7/latest/direct?email=<my-email> `
&& .\rhino_installer.exe -package -quiet `
&& del .\rhino_installer.exe
COPY --from=builder ["/src/bin/Release/compute.geometry", "/app"]
WORKDIR /app
ENV RHINO_COMPUTE_URLS="http://+:80"
EXPOSE 80
CMD ["compute.geometry.exe"]
The build fails on .\rhino_installer.exe -package -quiet step. I think this is because running this command triggers user account control which ask for permission to run this command.
I also changed the base image because I build on Windows 11 and Windows 1809 build fails with The container operating system does not match the host operating system error.
Could you please help us to run the installer without the need for GUI
This happens when you’re trying for instance to build an x86 container on an arm host.
I just tested the dockerfile from the compute.rhino3d repository. I changed it to use the same bakes images as you have, and I then also commented out the dotnet-framework installer, since that shouldn’t be necessary (unless your code relies on that). Building of the docker image worked fine.
Note that I had to explicitly switch my Docker Desktop to Windows containers, then I also made docker-windows the default builder. I did not try running the image with compute.geometry.exe, but rather set ENTRYPOINT [ "cmd.exe" ] and cd into the installation location for Rhino to see that it is in there.
addendum: to clarify: my Windows machine is an AMD CPU machine, so x64 (x86_64), not arm64.
### builder image
FROM mcr.microsoft.com/dotnet/sdk:7.0 as builder
# copy everything, restore nuget packages and build app
COPY src/ ./src/
RUN dotnet build -c Release src/compute.sln
FROM mcr.microsoft.com/windows/server:ltsc2022
RUN curl -fSLo rhino_installer.exe https://files.mcneel.com/dujour/exe/20210319/rhino_en-us_7.4.21078.01001.exe
RUN .\rhino_installer.exe -package -quiet -passive -norestart
COPY --from=builder ["/src/bin/Release/compute.geometry", "/app"]
WORKDIR /app
# bind compute.geometry to port 80
ENV RHINO_COMPUTE_URLS="http://+:80"
EXPOSE 80
CMD ["compute.geometry.exe"]
I was able to set the server to windows server 2022 dotnet 4.8 and install rhino 7. the installation in the docker was successful but after running the command compute.geometry.exe, there seems to be an error I am now getting with COM component.
System.Runtime.InteropServices.COMException (0x80004005): Error HRESULT E_FAIL has been returned from a call to a COM component.
at Rhino.Runtime.InProcess.RhinoCore.InternalStartup(Int32 argc, String[] argv, StartupInfo& info, IntPtr hostWnd)
at Rhino.Runtime.InProcess.RhinoCore..ctor(String[] args, WindowStyle windowStyle, IntPtr hostWnd)
at compute.geometry.OwinSelfHost.Start(HostControl hctrl) in C:\src\compute.geometry\Program.cs:line 115
at Topshelf.Builders.ControlServiceBuilder`1.ControlServiceHandle.Start(HostControl hostControl)
at Topshelf.Hosts.ConsoleRunHost.Run()
Since the console output says that “Rhino is not supported on Windows Server”… this makes me think that you haven’t set the core-hour billing licensing information correctly. If you follow this guide, at the bottom, you’ll see that there is a way to set an environment variable called RHINO_TOKEN to the core-hour billing license auth token found in the license portal.