Netcore app fails to start

Hi all, I have a dotnet core 3.1 API c# project which depends on a Postgres database
which works perfectly on a Linux Debian box.

As part of my docker learning curve I thought I would have a shot at getting it to run in a Docker container.
I succeeded using these Dockerfiles and a docker-compose file

API Dockerfile

# Get Base Image (Full .NET Core SDK)
FROM mcr.microsoft.com/dotnet/core/sdk:3.1 AS build-env
WORKDIR /app

# Copy csproj and restore
COPY *.csproj ./

# Copy everything else and build
COPY . ./
RUN dotnet publish -c Release -o out

# Generate runtime image
FROM mcr.microsoft.com/dotnet/core/aspnet:3.1
WORKDIR /app
COPY --from=build-env /app/out .
ENTRYPOINT ["dotnet", "Mydll.dll"]

Postgres Dockerfile

FROM postgres
ENV POSTGRES_PASSWORD password
ENV POSTGRES_DB mydb
COPY my_seed_data.sql /docker-entrypoint-initdb.d
WORKDIR /

docker-compose.yml

version: '3'
services:
  app:
    hostname: MyAPI
    build: .
    ports:
      - "1234:9654"
    volumes:
      - /home/pjk/Docker/App:/app
        
    depends_on:
      - dbase
  dbase:
    hostname: DockMyDatabase
    build: ./db/
    ports:
      - "5433:5432"
    volumes:
      - /home/pjk/Docker/Data:/var/lib/postgresql/data

The entity names are obviously modified but the essence is accurate

All this worked perfectly until I upgraded to netcore 5, the postgres part of the build still worked but my netcore project failed to start with docker logs showing

 It was not possible to find any installed .NET Core SDKs
 Did you mean to run .NET Core SDK commands? Install a .NET Core SDK from:

Oddly when I changed the dotnet build back to 3.1 the api part would fail whereas previously it succeeded

I hope this makes sense to someone

Edit

I’ve found the problem it was the final WORKDIR /app in the API Dockerfile so the the container couldn’t find the dotnet command or the dll - I must of accidentiy added it - sorry for the red herring

I am also facing the same problem with 3.1 build and the container is crashing with same error.
How did you fix this. Could you please help me with the resolution?