Skip to content

Instantly share code, notes, and snippets.

@YhorbyMatias
Created September 20, 2018 15:50
Show Gist options
  • Save YhorbyMatias/a875150805c2c2a3515821a553766a7a to your computer and use it in GitHub Desktop.
Save YhorbyMatias/a875150805c2c2a3515821a553766a7a to your computer and use it in GitHub Desktop.
FROM microsoft/aspnetcore-build:2.0 AS build-env
WORKDIR /app
# Copy csproj and restore as distinct layers
COPY *.csproj ./
RUN dotnet restore
# Copy everything else and build
COPY . ./
RUN dotnet publish -c Release -o out
# Build runtime image
FROM microsoft/aspnetcore:2.0
WORKDIR /app
COPY --from=build-env /app/out .
ENTRYPOINT ["dotnet", "HelloWorld.dll"]
FROM microsoft/aspnetcore-build:2.0 AS build-env
WORKDIR /app
# Copy csproj and restore as distinct layers
COPY *.csproj ./
RUN dotnet restore
# Copy everything else and build
COPY . ./
RUN dotnet publish -c Release -o out
# Build runtime image
FROM microsoft/aspnetcore:2.0
WORKDIR /app
COPY --from=build-env /app/out .
ENTRYPOINT ["dotnet", "HelloWorld.dll"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment