Created
June 13, 2019 08:25
-
-
Save nickcoad/e5b8586a0815a151be00d313f3b2d998 to your computer and use it in GitHub Desktop.
Cacheable restores dotnet core
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| FROM microsoft/dotnet:2.2-sdk AS restore | |
| WORKDIR /tmp/build | |
| COPY ./*.sln . | |
| COPY ./*/*.csproj ./ | |
| RUN for file in $(ls *.csproj); do mkdir -p ${file%.*}/ && mv $file ${file%.*}/; done | |
| RUN dotnet restore | |
| # Copy in the source files | |
| FROM restore AS build | |
| WORKDIR /tmp/build | |
| COPY . . | |
| RUN dotnet publish -o output MyApp/MyApp.csproj | |
| FROM microsoft/dotnet:2.2-aspnetcore-runtime AS runtime | |
| WORKDIR /app | |
| COPY --from=build /tmp/build/MyApp/output . | |
| ENTRYPOINT [ "dotnet", "MyApp.dll"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment