Created
November 19, 2018 16:50
-
-
Save robinmanuelthiel/0509487f964bee8df3136fb6470a5c21 to your computer and use it in GitHub Desktop.
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
####################################################### | |
# Step 1: Build the application in a container # | |
####################################################### | |
# Download the official ASP.NET Core SDK image | |
# to build the project while creating the docker image | |
FROM microsoft/dotnet:2.1-sdk as build | |
WORKDIR /app | |
# Restore NuGet packages | |
COPY *.csproj . | |
RUN dotnet restore | |
# Copy the rest of the files over | |
COPY . . | |
# Build the application | |
RUN dotnet publish --output /out/ --configuration Release | |
####################################################### | |
# Step 2: Run the build outcome in a container # | |
####################################################### | |
# Download the official ASP.NET Core Runtime image | |
# to run the compiled application | |
FROM microsoft/dotnet:2.1-aspnetcore-runtime | |
WORKDIR /app | |
# Open HTTP and HTTPS ports | |
EXPOSE 80 | |
EXPOSE 443 | |
# Copy the build output from the SDK image | |
COPY --from=build /out . | |
# Start the application | |
ENTRYPOINT ["dotnet", "ContosoMaintenance.WebAPI.dll"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment