Last active
January 13, 2020 09:52
-
-
Save NBprojekt/3317bce4ac3b591175634aa062719be6 to your computer and use it in GitHub Desktop.
Dockerfile to host dotnet core apps like blazor (dotnet core 3.0)
This file contains 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
# Create build img | |
FROM mcr.microsoft.com/dotnet/core/sdk:3.0 AS build | |
WORKDIR /app | |
# Copy csproj and restore as distinct layers | |
COPY *.sln . | |
COPY ./{PROJECT_NAME}/*.csproj ./{PROJECT_NAME}/ | |
RUN dotnet restore | |
# Copy everything else and build app | |
COPY ./{PROJECT_NAME}/. ./{PROJECT_NAME}/ | |
RUN dotnet publish -c Release -o out | |
# Create runtime image | |
FROM mcr.microsoft.com/dotnet/core/aspnet:3.0 AS runtime | |
WORKDIR /app | |
COPY --from=build /app/out ./ | |
ENTRYPOINT ["dotnet", "{PROJECT_NAME}.dll"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment