diff --git a/AdventOfCode/Dockerfile b/AdventOfCode/Dockerfile new file mode 100644 index 0000000..ddaf901 --- /dev/null +++ b/AdventOfCode/Dockerfile @@ -0,0 +1,27 @@ +FROM mcr.microsoft.com/dotnet/aspnet:5.0 AS base +WORKDIR /app +EXPOSE 80 +EXPOSE 443 + +FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build +WORKDIR /src +COPY . ./ +RUN dotnet restore + +#COPY ["/src/AdventOfCode/AdventOfCode.csproj", "AdventOfCode/"] +RUN dotnet restore "AdventOfCode.csproj" +#COPY ["AdventOfCode/", "AdventOfCode/."] + + +RUN dotnet build "AdventOfCode.csproj" -c Release -o /app/build + +FROM build AS publish +RUN dotnet publish "./AdventOfCode.csproj" -c Release -o /app/publish + +FROM base AS final +WORKDIR /app + +ENV ASPNETCORE_ENVIRONMENT=Production +ENV ASPNETCORE_URLS=http://+:80 +COPY --from=publish /app/publish . +ENTRYPOINT ["dotnet", "AdventOfCode.dll"] \ No newline at end of file diff --git a/AdventOfCode/Startup.cs b/AdventOfCode/Startup.cs index e0345f2..1be6edb 100644 --- a/AdventOfCode/Startup.cs +++ b/AdventOfCode/Startup.cs @@ -51,10 +51,11 @@ namespace AdventOfCode if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); - app.UseSwagger(); - app.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json", "AdventOfCode v1")); } + app.UseSwagger(); + app.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json", "AdventOfCode v1")); + app.UseHttpsRedirection(); app.UseRouting();