Skip to content

Commit

Permalink
Use multistage build so that the image is published from the runtime …
Browse files Browse the repository at this point in the history
…image instead of the SDK image.

This brings the final image size to 230MB down from 1.8GB.
Tried using alpine but ran into libgit2 issues (maybe related to dotnet/Nerdbank.GitVersioning#314 )
  • Loading branch information
mausch authored and andrewlock committed Jun 27, 2019
1 parent 1c9de90 commit 9b1ca8a
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
FROM microsoft/dotnet:2.1.504-sdk AS builder

FROM mcr.microsoft.com/dotnet/core/sdk:2.1-stretch AS builder
ENV NBGV_VERSION 2.3.38

RUN dotnet tool install --global nbgv --version $NBGV_VERSION

ENV PATH="/root/.dotnet/tools:${PATH}"

ENTRYPOINT ["nbgv"]
FROM mcr.microsoft.com/dotnet/core/runtime:2.1-stretch-slim
COPY --from=builder /root/.dotnet/tools/ /opt/bin
ENV PATH="/opt/bin:${PATH}"
ENTRYPOINT ["nbgv"]

0 comments on commit 9b1ca8a

Please sign in to comment.