data-api-builder icon indicating copy to clipboard operation
data-api-builder copied to clipboard

[Bug]: Docker build fails, requested .net version does not match the build container

Open regtm opened this issue 5 months ago • 2 comments

What happened?

When trying to build the Dockerfile the build process fails. The global.json does indeed require version 8.0.100:

docker build -f "Dockerfile" -t dataapibuilder:latest "."
[+] Building 0.3s (10/12)                                                                                                                             docker:default
 => [internal] load build definition from Dockerfile                                                                                                            0.0s
 => => transferring dockerfile: 578B                                                                                                                            0.0s
 => [internal] load metadata for mcr.microsoft.com/dotnet/aspnet:6.0-cbl-mariner2.0                                                                             0.1s
 => [internal] load metadata for mcr.microsoft.com/dotnet/sdk:6.0-cbl-mariner2.0.                                                                               0.1s
 => [internal] load .dockerignore                                                                                                                               0.0s
 => => transferring context: 2B                                                                                                                                 0.0s
 => [build 1/4] FROM mcr.microsoft.com/dotnet/sdk:6.0-cbl-mariner2.0.@sha256:c3e1b51ec0d87798c598cef029aa3070bcfca299f419c09e3565a5cfdfb52c77                   0.0s
 => CACHED [runtime 1/3] FROM mcr.microsoft.com/dotnet/aspnet:6.0-cbl-mariner2.0@sha256:0281acf4da2032e112615ee4083b52bf7f103c4ddcb2878e14c313839d015930        0.0s
 => [internal] load build context                                                                                                                               0.0s
 => => transferring context: 208.38kB                                                                                                                           0.0s
 => CACHED [build 2/4] WORKDIR /src                                                                                                                             0.0s
 => CACHED [build 3/4] COPY [., ./]                                                                                                                             0.0s
 => ERROR [build 4/4] RUN dotnet build "./src/Service/Azure.DataApiBuilder.Service.csproj" -c Docker -o /out -r linux-x64                                       0.2s
------                                                                                                                                                               
 > [build 4/4] RUN dotnet build "./src/Service/Azure.DataApiBuilder.Service.csproj" -c Docker -o /out -r linux-x64:                                                  
0.105 The command could not be loaded, possibly because:                                                                                                             
0.105   * You intended to execute a .NET application:                                                                                                                
0.105       The application 'build' does not exist.                                                                                                                  
0.105   * You intended to execute a .NET SDK command:                                                                                                                
0.105       A compatible .NET SDK was not found.
0.105 
0.105 Requested SDK version: 8.0.100
0.105 global.json file: /src/global.json
0.105 
0.105 Installed SDKs:
0.105 
0.105 Install the [8.0.100] .NET SDK or update [/src/global.json] to match an installed SDK.
0.105 
0.105 Learn about SDK resolution:
0.105 https://aka.ms/dotnet/sdk-not-found
0.105 6.0.425 [/usr/share/dotnet/sdk]
------
Dockerfile:8
--------------------
   6 |     WORKDIR /src
   7 |     COPY [".", "./"]
   8 | >>> RUN dotnet build "./src/Service/Azure.DataApiBuilder.Service.csproj" -c Docker -o /out -r linux-x64
   9 |     
  10 |     FROM mcr.microsoft.com/dotnet/aspnet:6.0-cbl-mariner2.0 AS runtime
--------------------
ERROR: failed to solve: process "/bin/sh -c dotnet build \"./src/Service/Azure.DataApiBuilder.Service.csproj\" -c Docker -o /out -r linux-x64" did not complete successfully: exit code: 145

regtm avatar Sep 13 '24 10:09 regtm