Created
August 26, 2021 11:51
-
-
Save heberop/afdbdfb014b799e01e141c617422252a to your computer and use it in GitHub Desktop.
Dockerfile sample copying first .sln and .csproj only and restore
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM mcr.microsoft.com/dotnet/sdk:5.0-buster-slim AS builder | |
WORKDIR /build | |
COPY src/*.sln ./nuget.config ./ | |
COPY src/*/*.csproj ./ | |
RUN for from in ./*.csproj; do to=$(echo "$from" | sed 's/\/\([^/]*\)\.csproj$/\/\1&/') \ | |
&& mkdir -p "$(dirname "$to")" && mv "$from" "$to"; done | |
RUN dotnet restore --configfile ./nuget.config | |
COPY src/. ./ | |
RUN dotnet build |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment