Skip to content

Commit ab8745d

Browse files
Cache vsdbg in first layer to speed up rebuild time; Minor change to decrease the overall image size (#25)
1 parent 2463035 commit ab8745d

File tree

2 files changed

+16
-10
lines changed

2 files changed

+16
-10
lines changed
Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
FROM microsoft/dotnet:2.0-runtime-stretch AS base
2+
3+
RUN apt-get update && \
4+
apt-get install -y --no-install-recommends unzip procps && \
5+
curl -sSL https://aka.ms/getvsdbgsh | bash /dev/stdin -v latest -l ~/vsdbg && \
6+
rm -rf /var/lib/apt/lists/*
7+
18
FROM microsoft/dotnet:2.0-sdk AS build-env
29
WORKDIR /app
310

@@ -7,12 +14,8 @@ RUN dotnet restore
714
COPY . ./
815
RUN dotnet publish -c Debug -o out
916

10-
FROM microsoft/dotnet:2.0-runtime-stretch
17+
FROM base
1118
WORKDIR /app
1219
COPY --from=build-env /app/out ./
1320

14-
RUN apt-get update
15-
RUN apt-get install -y unzip procps
16-
RUN curl -sSL https://aka.ms/getvsdbgsh | bash /dev/stdin -v latest -l ~/vsdbg
17-
1821
ENTRYPOINT ["dotnet", "SampleModule.dll"]
Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
FROM microsoft/dotnet:2.0-runtime-stretch AS base
2+
3+
RUN apt-get update && \
4+
apt-get install -y --no-install-recommends unzip procps && \
5+
curl -sSL https://aka.ms/getvsdbgsh | bash /dev/stdin -v latest -l ~/vsdbg && \
6+
rm -rf /var/lib/apt/lists/*
7+
18
FROM microsoft/dotnet:2.0-sdk AS build-env
29
WORKDIR /app
310

@@ -7,12 +14,8 @@ RUN dotnet restore
714
COPY . ./
815
RUN dotnet publish -c Debug -o out
916

10-
FROM microsoft/dotnet:2.0-runtime-stretch
17+
FROM base
1118
WORKDIR /app
1219
COPY --from=build-env /app/out ./
1320

14-
RUN apt-get update
15-
RUN apt-get install -y unzip procps
16-
RUN curl -sSL https://aka.ms/getvsdbgsh | bash /dev/stdin -v latest -l ~/vsdbg
17-
1821
ENTRYPOINT ["dotnet", "SampleModule.dll"]

0 commit comments

Comments
 (0)