From a37e39bd33231a667fe17e22577aa7cdaecd7b7a Mon Sep 17 00:00:00 2001 From: ali Date: Wed, 14 Aug 2024 10:02:36 +0330 Subject: [PATCH] fix(Dockerfile): new Env var added --- Dockerfile | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/Dockerfile b/Dockerfile index 3187486..533e16f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,16 +1,21 @@ -FROM mcr.microsoft.com/dotnet/sdk:latest AS build-env +FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build WORKDIR /app -EXPOSE 80 -EXPOSE 443 -# Copy the csproj and restore all of the nugets -COPY . ./ -RUN dotnet restore ./AnalysisData/AnalysisData.sln -# Copy everything else and build -#COPY . ./ -RUN dotnet publish -c Release -o out ./AnalysisData/AnalysisData.sln -# Build runtime image -FROM mcr.microsoft.com/dotnet/sdk:latest + +COPY ./AnalysisData/ ./ +RUN dotnet restore +COPY . . + +RUN dotnet publish ./AnalysisData/AnalysisData/AnalysisData.csproj -c Release -o out + +FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS runtime WORKDIR /app -COPY --from=build-env /app/out . -ENTRYPOINT ["dotnet", "AnalysisData.dll"] +COPY --from=build /app/out ./ +ENV ASPNETCORE_ENVIRONMENT=Development +#ENV ConnectionStrings__DefaultConnection=Host=db;Database=YourDatabaseName;Username=yourusername;Password=yourpassword +ENV ASPNETCORE_URLS=http://*:80 +EXPOSE 80 + + +# Start the application +ENTRYPOINT ["dotnet", "AnalysisData.dll"]