Skip to content

Instantly share code, notes, and snippets.

@radu-matei
Created November 23, 2017 16:11
Show Gist options
  • Save radu-matei/de63a6a0bdb28263f7a703947c22b905 to your computer and use it in GitHub Desktop.
Save radu-matei/de63a6a0bdb28263f7a703947c22b905 to your computer and use it in GitHub Desktop.
dockerfile-alpine
FROM microsoft/dotnet-nightly:2.1-sdk AS build-env
WORKDIR /app
# copy csproj and restore as distinct layers
COPY *.csproj ./
COPY NuGet.config ./
RUN dotnet restore
# copy everything else and build
COPY . ./
RUN dotnet publish -c Release -o out --no-restore
# build runtime image
FROM microsoft/dotnet-nightly:2.1-runtime-alpine
WORKDIR /app
COPY --from=build-env /app/out ./
ENTRYPOINT ["dotnet", "dotnetapp.dll"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment