EdwinVW / dapr-traffic-control

Simple sample application for experimenting with dapr.
Apache License 2.0
317 stars 162 forks source link

Docker build fails after update to DotNet 8. #32

Closed markarnott closed 7 months ago

markarnott commented 7 months ago

The TargetFramework in the csproj files is net8.0.

The Dockerfile uses dotnet/sdk:7.0-bullseye-slim

These two are incompatible.

Steps to reproduce the behavior:

  1. cd src/TrafficControlService
  2. docker build .

Expected behavior A new image should be created.

Error Message

 => CACHED [build-env 3/6] COPY TrafficControlService.csproj ./                                                    0.0s
 => ERROR [build-env 4/6] RUN dotnet restore                                                                       1.3s
------
 > [build-env 4/6] RUN dotnet restore:
#0 1.187   Determining projects to restore...
#0 1.201 /usr/share/dotnet/sdk/7.0.406/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.TargetFrameworkInference.targets(160,5): error NETSDK1045: The current .NET SDK does not support targeting .NET 8.0.  Either target .NET 7.0 or lower, or use a version of the .NET SDK that supports .NET 8.0. Download the .NET SDK from https://aka.ms/dotnet/download [/app/TrafficControlService.csproj]
------
Dockerfile:6
--------------------
   4 |     # Copy necessary files and restore as distinct layer
   5 |     COPY TrafficControlService.csproj ./
   6 | >>> RUN dotnet restore
   7 |
   8 |     # Copy everything else and build
--------------------
ERROR: failed to solve: process "/bin/sh -c dotnet restore" did not complete successfully: exit code: 1

Environment

EdwinVW commented 7 months ago

Hi @markarnott. Thanks for spotting this issue! I have fixed it in #34.