Skip to content

Instantly share code, notes, and snippets.

@melvinlee
Created August 10, 2020 11:56
Show Gist options
  • Select an option

  • Save melvinlee/47cbc24d83ada693696446aa92debe33 to your computer and use it in GitHub Desktop.

Select an option

Save melvinlee/47cbc24d83ada693696446aa92debe33 to your computer and use it in GitHub Desktop.
Baked NuGet packages cache into base images.
find . -name "*.csproj" -print0 \
| tar -cvf projectfiles.tar --null -T -
FROM mcr.microsoft.com/dotnet/core/sdk:3.1
# warmup NuGet package cache
WORKDIR /sln
COPY *.sln .
COPY projectfiles.tar .
RUN tar -xvf projectfiles.tar
RUN dotnet restore \
--source https://api.nuget.org/v3/index.json
WORKDIR /
RUN rm -rf /sln
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment