działajacy dockerfile
FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build
WORKDIR /app
#
# copy csproj and restore as distinct layers
COPY ./Backend/TeSt/TeSt.Common/*.csproj ./TeSt.Common/
COPY ./Backend/TeSt/TeSt.Server/*.csproj ./TeSt.Server/
#
# copy everything else and build app
COPY ./Backend/TeSt/TeSt.Common/. ./TeSt.Common/
COPY ./Backend/TeSt/TeSt.Server/. ./TeSt.Server/
#
WORKDIR /app/TeSt.Server
RUN dotnet publish -c Release -o out
#
FROM mcr.microsoft.com/dotnet/aspnet:5.0 AS runtime
WORKDIR /app
#
COPY --from=build /app/TeSt.Server/out ./
ENTRYPOINT ["dotnet", "TeSt.Server.dll"]
skopiowałem, działajacy dockerfile i chciałem zbudowac inny projekt (w tej samej solucji)
FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build
WORKDIR /app
#
# copy csproj and restore as distinct layers
COPY ./Backend/TeSt/TeSt.Common/*.csproj ./TeSt.Common/
COPY ./Backend/TeSt/TeSt.Languages/*.csproj ./TeSt.Languages/
#
# copy everything else and build app
COPY ./Backend/TeSt/TeSt.Common/. ./TeSt.Common/
COPY ./Backend/TeSt/TeSt.Languages/. ./TeSt.Languages/
#
WORKDIR /app/TeSt.Languages
RUN dotnet publish -c Release -o out
#
FROM mcr.microsoft.com/dotnet/aspnet:5.0 AS runtime
WORKDIR /app
#
COPY --from=build /app/TeSt.Languages/out ./
ENTRYPOINT ["dotnet", "TeSt.Languages.dll"]
przy drugim dostaje
$ docker run -p 5520:5520 testaaa
Could not execute because the application was not found or a compatible .NET SDK is not installed.
Possible reasons for this include:
* You intended to execute a .NET program:
The application 'GruPie.Languages.dll' does not exist.
* You intended to execute a .NET SDK command:
It was not possible to find any installed .NET SDKs.
Install a .NET SDK from:
https://aka.ms/dotnet-download
przy budowaniu niedzialajacego dostaje
#15 [build 8/8] RUN dotnet publish -c Release -o out
#15 sha256:1ddab18a927f8a6385f90d98dcb38c87038def28b0a676a241bb710f55866773
#15 0.601 Microsoft (R) Build Engine version 16.11.0+0538acc04 for .NET
#15 0.601 Copyright (C) Microsoft Corporation. All rights reserved.
#15 0.601
#15 1.053 Determining projects to restore...
#15 4.439 Restored /app/TeSt.Common/TeSt.Common.csproj (in 3.12 sec).
#15 4.443 Restored /app/TeSt.Languages/TeSt.Languages.csproj (in 3.12 sec).
#15 4.455 /usr/share/dotnet/sdk/5.0.401/Current/Microsoft.Common.props(63,3): warning MSB4011: "/app/TeSt.Languages/obj/TeSt.Languages.csproj.nuget.g.props" cannot be imported again. It was already imported at "/usr/share/dotnet/sdk/5.0.401/Current/Microsoft.Common.props (63,3)". This is most likely a build authoring error. This subsequent import will be ignored. [/app/TeSt.Languages/TeSt.Languages.csproj]
#15 4.488 /usr/share/dotnet/sdk/5.0.401/Microsoft.Common.targets(128,3): warning MSB4011: "/app/TeSt.Languages/obj/TeSt.Languages.csproj.nuget.g.targets" cannot be imported again. It was already imported at "/usr/share/dotnet/sdk/5.0.401/Microsoft.Common.targets (128,3)". This is most likely a build authoring error. This subsequent import will be ignored. [/app/TeSt.Languages/TeSt.Languages.csproj]
#15 6.322 TeSt.Common -> /app/TeSt.Common/bin/Release/net5.0/TeSt.Common.dll
#15 6.761 TeSt.Languages -> /app/TeSt.Languages/bin/Release/net5.0/TeSt.Languages.dll
#15 6.808 TeSt.Languages -> /app/TeSt.Languages/out/
#15 DONE 6.9s
przy dzialajacym tego nie ma. Wiec spodziewalbym sie ze
#15 4.455 /usr/share/dotnet/sdk/5.0.401/Current/Microsoft.Common.props(63,3): warning MSB4011: "/app/TeSt.Languages/obj/TeSt.Languages.csproj.nuget.g.props" cannot be imported again. It was already imported at "/usr/share/dotnet/sdk/5.0.401/Current/Microsoft.Common.props (63,3)". This is most likely a build authoring error. This subsequent import will be ignored. [/app/TeSt.Languages/TeSt.Languages.csproj]
#15 4.488 /usr/share/dotnet/sdk/5.0.401/Microsoft.Common.targets(128,3): warning MSB4011: "/app/TeSt.Languages/obj/TeSt.Languages.csproj.nuget.g.targets" cannot be imported again. It was already imported at "/usr/share/dotnet/sdk/5.0.401/Microsoft.Common.targets (128,3)". This is most likely a build authoring error. This subsequent import will be ignored. [/app/TeSt.Languages/TeSt.Languages.csproj]
jest błedem, jednak nie wiem jak to naprawic