Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dockerfile.amd64.debug improvements #93

Closed
jessebenson opened this issue Mar 27, 2018 · 2 comments
Closed

Dockerfile.amd64.debug improvements #93

jessebenson opened this issue Mar 27, 2018 · 2 comments
Assignees

Comments

@jessebenson
Copy link
Member

jessebenson commented Mar 27, 2018

The current Dockerfile.amd64.debug causes significantly longer rebuild times than necessary, and requires significantly more bytes to be pushed due to Docker layer changes. With the changes below, a trivial C# Module on rebuild only needs to push ~10MB instead of 170MB+, and rebuilds are faster since the vsdbg layer is cached. The main issue is vsdbg is installed as one of the last steps, when it should be installed as one of the first steps.

Current Dockerfile.amd64.debug template:

FROM microsoft/dotnet:2.0-sdk AS build-env
WORKDIR /app

COPY *.csproj ./
RUN dotnet restore

COPY . ./
RUN dotnet publish -c Debug -o out

FROM microsoft/dotnet:2.0-runtime-stretch AS runtime
WORKDIR /app
COPY --from=build-env /app/out ./

RUN apt-get update
RUN apt-get install -y unzip procps
RUN curl -sSL https://aka.ms/getvsdbgsh | bash /dev/stdin -v latest -l ~/vsdbg

ENTRYPOINT ["dotnet", "echo-service.dll"]

Improved Dockerfile.amd64.debug template:

FROM microsoft/dotnet:2.0-runtime-stretch AS runtime

RUN apt-get update
RUN apt-get install -y unzip procps
RUN curl -sSL https://aka.ms/getvsdbgsh | bash /dev/stdin -v latest -l ~/vsdbg

FROM microsoft/dotnet:2.0-sdk AS build-env
WORKDIR /app

COPY *.csproj ./
RUN dotnet restore

COPY . ./
RUN dotnet publish -c Debug -o out

FROM runtime
WORKDIR /app
COPY --from=build-env /app/out ./

ENTRYPOINT ["dotnet", "echo-service.dll"]
@adashen
Copy link
Member

adashen commented Mar 27, 2018

good suggestion from Jesse, @formulahendry we can improve this in the next release of dotnet template

@formulahendry
Copy link
Member

Thanks @jessebenson for your feedback! We have just released the new dotnet template with your suggestion: https://www.nuget.org/packages/Microsoft.Azure.IoT.Edge.Module/1.3.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants