Hi I’m tyring to run .net 8 core webassemply in a docker container, which will return be started from my docker compose. When I run docker file by it self, everything builds and no issues, but as soon as I try to run it from a docker-compose, that when I get
CSC : error CS5001: Program does not contain a static 'Main' method suitable for an entry point [/src/ThirdPartyFreight.Web/ThirdPartyFreight.Web.csproj]
This is a webassembly project, so not sure why it wont run when using a docker-compose vs just running it by docker run.
Any suggestions? I have try adding ENTRYPOINT but make no change.
Dockerfile
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
ARG BUILD_CONFIGURATION=Release
WORKDIR /src
COPY src/ThirdPartyFreight.Web/ThirdPartyFreight.Web.csproj ThirdPartyFreight.Web/
COPY src/ThirdPartyFreight.Application/ThirdPartyFreight.Application.csproj ThirdPartyFreight.Application/
COPY src/ThirdPartyFreight.Domain/ThirdPartyFreight.Domain.csproj ThirdPartyFreight.Domain/
RUN dotnet restore ThirdPartyFreight.Web/ThirdPartyFreight.Web.csproj
COPY . .
WORKDIR "/src/ThirdPartyFreight.Web"
RUN dotnet build "ThirdPartyFreight.Web.csproj" -c $BUILD_CONFIGURATION -o /app/build
FROM build AS publish
ARG BUILD_CONFIGURATION=Release
RUN dotnet publish "ThirdPartyFreight.Web.csproj" -c $BUILD_CONFIGURATION -o /app/publish
FROM nginx:alpine AS final
WORKDIR /user/share/nginx/html
COPY --from=publish /app/publish/wwwroot .
COPY src/ThirdPartyFreight.Web/nginx.conf /etc/nginx/nginx.conf
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]
docker compose
services:
thirdpartyfreight.api:
image: ${DOCKER_REGISTRY-}thirdpartyfreightapi
container_name: ThirdPartyFreight.Api
build:
context: .
dockerfile: src/ThirdPartyFreight.Api/Dockerfile
ports:
- "28080:8080"
- "28081:8081"
csdtpfblazorwebapp-db:
image: mcr.microsoft.com/mssql/server:2022-latest
container_name: CSDTPFBlazorWebApp.Db
environment:
SA_PASSWORD: "SuperHardPassword!!"
ACCEPT_EULA: "Y"
ports:
- "1433:1433"
volumes:
- ./.containers/database:/var/opt/mssql/data
csdtpfblazorwebapp-idp:
image: quay.io/keycloak/keycloak:latest
container_name: CSDTPFBlazorWebApp.Identity
environment:
- KEYCLOAK_ADMIN=admin
- KEYCLOAK_ADMIN_PASSWORD=admin
command:
- start-dev
ports:
- "18080:8080"
csdtpfblazorwebapp-seq:
image: datalust/seq:latest
container_name: CSDTPFBlazorWebApp.Seq
environment:
- ACCEPT_EULA=Y
ports:
- "5341:5341"
- "8081:80"
csdtpfblazorwebapp-redis:
image: redis:latest
container_name: CSDTPFBlazorWebApp.Redis
ports:
- "6379:6379"
elsa-studio:
image: elsaworkflows/elsa-studio-v3:latest
container_name: elsa-studio
environment:
- HTTP_PORTS=8080
- ELSASERVER__URL=https://localhost:5001/elsa/api
ports:
- "14000:8080"
thirdpartyfreight.web:
container_name: ThirdPartyFreight.Web
build:
context: .
dockerfile: src/ThirdPartyFreight.Web/Dockerfile
ports:
- "28080:80"