Problem mit Docker Build von a .net8.0 webapiC#

Ein Treffpunkt für C#-Programmierer
Guest
 Problem mit Docker Build von a .net8.0 webapi

Post by Guest »

Ich habe ein Problem mit meinem Projekt zusammen mit Docker.root/
---docker/
------compose.yaml
---src/
------BusinessPlanner.Extensions
---------BusinessPlanner.Extensions.csproj
------Users/
---------Users.csproj
---------Dockerfile
< /code>
my compose.yaml sieht so aus: < /p>
user-db:
image: postgres:latest
environment:
POSTGRES_DB: users
POSTGRES_USER: myuser
POSTGRES_PASSWORD: mypassword
DB_HOST: 127.0.0.1
ports:
- "5432:5432"
volumes:
- pgdata:/var/lib/postgresql/data
user-app:
build:
context: ../
dockerfile: src/Users/Dockerfile
environment:
ASPNETCORE_ENVIRONMENT: Release
image: "users"
ports:
- "8080:8080"
depends_on:
- user-db

volumes:
pgdata:
driver: local
< /code>
Meine Dockerfile sieht so aus: < /p>
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS base
USER $APP_UID
WORKDIR /app
EXPOSE 8080
EXPOSE 8081

FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
ARG BUILD_CONFIGURATION=Release
WORKDIR /src
COPY ["src/BusinessPlanner.Extensions/BusinessPlanner.Extensions.csproj", "BusinessPlanner.Extensions/"]
COPY ["src/Users/Users.csproj", "Users/"]
RUN dotnet restore "Users/Users.csproj"
COPY . .
WORKDIR "Users/"
RUN dotnet build "Users.csproj" -c $BUILD_CONFIGURATION -o /app/build

FROM build AS publish
ARG BUILD_CONFIGURATION=Release
RUN dotnet build "Users.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false

FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "Users.dll"]
< /code>
Beim Ausführen des Befehls "Docker Compose Build" aus dem Docker -Ordner erhalte ich diesen Fehler:
=> Fehler [Build 8/8] DOTNE -Build ausführen "user.csproj "-c Release -o/App/Build
CSC: Fehler CS5001: Das Programm enthält keine statische" Hauptmethode "für einen Einstiegspunkt [/src
/users/users.csproj weibliche; p>
Die Benutzer.csproj ist ein Webapi, das ohne Probleme mit Dotnet -Lauf ausgeführt werden kann. Startet die Datenbank und die Webapi.
Was fehlt mir?

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post