Skip to content

Instantly share code, notes, and snippets.

@jonasbg
Created October 24, 2018 09:04
Show Gist options
  • Save jonasbg/cf84879a540a925a6e33146fd05c839c to your computer and use it in GitHub Desktop.
Save jonasbg/cf84879a540a925a6e33146fd05c839c to your computer and use it in GitHub Desktop.
Build Dockerfile for legacy ASP.NET project
# escape=`
FROM microsoft/dotnet-framework:4.7.2-sdk-windowsservercore-1803
ENV SOLUTION_NAME Solutionfile.sln
ENV PUBLISH_PROFILE Release
RUN mkdir C:\api
WORKDIR C:\\api
COPY . .
RUN nuget restore %SOLUTION_NAME%
RUN msbuild "C:\\api\\%SOLUTION_NAME%" `
/nologo /p:DeployOnBuild=True /p:PublishProfile=%PUBLISH_PROFILE% /p:configuration="Release" `
/p:VisualStudioVersion="15.0" `
/p:AspnetMergePath='"C:\\Program Files (x86)\\Microsoft SDKs\\Windows\\v10.0A\\bin\\NETFX 4.7.2 Tools"'
@jonasbg
Copy link
Author

jonasbg commented Oct 24, 2018

Build with docker build -t jonasbg/tag .
Testrun with docker run -it --rm jonasbg/tag powershell

Remember to run Docker with windows containers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment