Search code examples
monodockerowinwebsharper

WebSharper ui.next site working locally but not in docker


I have a site that's build using mono and WebSharper.UI.Next. It's selfhosted (Owin) and works flawlessly on my machine directly. However when I try executing it from within a docker container (FROM mono:3.10-onbuild) requesting one of the WebSHarper script files "dissappear" E.g. WebSharper.Collections.min.js returns a 404.

This behaviour can be reproduced with the project created by WebSHarpers client-server selfhosted Owin project template and the below dockerfile

FROM mono:3.10-onbuild
RUN ln -s /usr/src/app/build /usr/src/app/bin
CMD mono ./Site.exe http://*:9000
EXPOSE 9000

(Site should obviously match the name of the site being used)


Solution

  • It turns out that the trick is to override the default root directory when running in the docker container. changing the CMD from OP to

    CMD mono ./Site.exe _PublishedWebsites/Site/  http://*:9000    
    

    Will override the default home dir then I get all the scripts alright.