miroslavpopovic/auth-sample-openiddict

Docker-Compose build/up fail auth.admin

ghstahl opened this issue · 2 comments

Building problems.
clone and build test.

dotnet build worked
7.0.101

docker-compose build
docker-compose up

gave me the following errors.

PS > docker-compose build auth-admin
Building auth-admin
[+] Building 28.6s (14/17)
 => [internal] load build definition from Dockerfile                            0.0s
 => => transferring dockerfile: 32B                                             0.0s
 => [internal] load .dockerignore                                               0.0s
 => => transferring context: 35B                                                0.0s
 => [internal] load metadata for mcr.microsoft.com/dotnet/sdk:7.0               0.4s
 => [internal] load metadata for mcr.microsoft.com/dotnet/aspnet:7.0            0.0s
 => [build 1/7] FROM mcr.microsoft.com/dotnet/sdk:7.0@sha256:7864257426b137231  0.0s
 => [base 1/2] FROM mcr.microsoft.com/dotnet/aspnet:7.0                         0.0s
 => [internal] load build context                                               0.1s 
 => => transferring context: 717.98kB                                           0.1s 
 => CACHED [build 2/7] WORKDIR /src                                             0.0s
 => CACHED [build 3/7] COPY [src/Auth.Admin/Auth.Admin.csproj, src/Auth.Admin/  0.0s 
 => CACHED [build 4/7] RUN dotnet restore "src/Auth.Admin/Auth.Admin.csproj"    0.0s 
 => [build 5/7] COPY . .                                                        0.1s 
 => [build 6/7] WORKDIR /src/src/Auth.Admin                                     0.0s 
 => [build 7/7] RUN dotnet build "Auth.Admin.csproj" -c Release -o /app/build  21.9s 
 => ERROR [publish 1/1] RUN dotnet publish "Auth.Admin.csproj" -c Release -o /  6.1s 
------
 > [publish 1/1] RUN dotnet publish "Auth.Admin.csproj" -c Release -o /app/publish:  
#16 0.534 MSBuild version 17.4.0+18d5aef85 for .NET
#16 1.037   Determining projects to restore...
#16 1.424   All projects are up-to-date for restore.
#16 2.213   Auth -> /src/src/Auth/bin/Release/net7.0/Auth.dll
#16 5.464   Auth.Admin -> /src/src/Auth.Admin/bin/Release/net7.0/Auth.Admin.dll      
#16 6.004 /usr/share/dotnet/sdk/7.0.101/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.ConflictResolution.targets(112,5): error NETSDK1152: Found multiple publish output files with the same relative path: /src/src/Auth/appsettings.Development.json, /src/src/Auth.Admin/appsettings.Development.json, /src/src/Auth/appsettings.Docker.json, /src/src/Auth.Admin/appsettings.Docker.json, /src/src/Auth/appsettings.json, /src/src/Auth.Admin/appsettings.json. [/src/src/Auth.Admin/Auth.Admin.csproj]
------
executor failed running [/bin/sh -c dotnet publish "Auth.Admin.csproj" -c Release -o /app/publish]: exit code: 1
ERROR: Service 'auth-admin' failed to build : Build failed

Looks like I only tested it with Project Tye.
As soon as I find some time, I'll try Docker Compose too.
Thanks for reporting!

This should be fixed with the latest commit.

The issue was solved with adding <ErrorOnDuplicatePublishOutputFiles>false</ErrorOnDuplicatePublishOutputFiles> to Auth.Admin.csproj. More details about it can be found in this SO answer.