FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build
WORKDIR /source

COPY *.sln .
COPY Application/*.csproj ./Application/
COPY Domain/*.csproj ./Domain/
COPY Infrastructure/*.csproj ./Infrastructure/
COPY Apps/Website/*.csproj ./Apps/Website/

WORKDIR /source/Apps/Website
RUN dotnet restore

WORKDIR /source
COPY Application/. ./Application/
COPY Domain/. ./Domain/
COPY Infrastructure/. ./Infrastructure/
COPY Apps/Website/. ./Apps/Website/

WORKDIR /source/Apps/Website
RUN dotnet publish -c release -o /app --no-restore

FROM mcr.microsoft.com/dotnet/aspnet:5.0
WORKDIR /app
COPY --from=build /app ./
# ENV "ConnectionStrings:Default"="Data Source=hn.db"
ENV "ASPNETCORE_URLS" "http://0.0.0.0:5000"
EXPOSE 5000
ENTRYPOINT ["dotnet", "Website.dll"]