diff --git a/Tsi1.Api/.dockerignore b/Tsi1.Api/.dockerignore new file mode 100644 index 0000000000000000000000000000000000000000..2e9693ed1a9619a49dcd4c7f3e9ea26541ff27d7 --- /dev/null +++ b/Tsi1.Api/.dockerignore @@ -0,0 +1,2 @@ +obj +bin \ No newline at end of file diff --git a/Tsi1.Api/Dockerfile b/Tsi1.Api/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..bf550e58be847bab3046fae75fe153183bdbda5b --- /dev/null +++ b/Tsi1.Api/Dockerfile @@ -0,0 +1,23 @@ +# https://hub.docker.com/_/microsoft-dotnet-core +FROM mcr.microsoft.com/dotnet/core/sdk:3.1 AS build +WORKDIR /app +EXPOSE 443 + +# copy csproj and restore as distinct layers +WORKDIR /src +COPY Tsi1.Api/*.csproj ./Tsi1.Api/ +COPY Tsi1.BusinessLayer/*.csproj ./Tsi1.BusinessLayer/ +COPY Tsi1.DataLayer/*.csproj ./Tsi1.DataLayer/ +RUN dotnet dev-certs https -ep %USERPROFILE%\.aspnet\https\aspnetapp.pfx -p 111111 +RUN dotnet restore ./Tsi1.Api/Tsi1.Api.csproj + +# copy everything else and build app +COPY . ./ +WORKDIR /src/Tsi1.Api +RUN dotnet publish -c release -o /app/publish + +# final stage/image +FROM mcr.microsoft.com/dotnet/core/aspnet:3.1 +WORKDIR /app +COPY --from=build /app/publish . +ENTRYPOINT ["dotnet", "Tsi1.Api.dll"] \ No newline at end of file diff --git a/Tsi1.Api/Tsi1.Api/Program.cs b/Tsi1.Api/Tsi1.Api/Program.cs index 50e6716c5925665dc0b091548bd2fc4b82d4b82c..e864adfcab4e11e1b7d69580b29ea8661d208789 100644 --- a/Tsi1.Api/Tsi1.Api/Program.cs +++ b/Tsi1.Api/Tsi1.Api/Program.cs @@ -21,6 +21,7 @@ namespace Tsi1.Api .ConfigureWebHostDefaults(webBuilder => { webBuilder.UseStartup<Startup>(); + webBuilder.UseUrls("http://*:5000/"); }); } } diff --git a/Tsi1.Api/Tsi1.Api/Properties/launchSettings.json b/Tsi1.Api/Tsi1.Api/Properties/launchSettings.json index c733fd6ce95de3866e074b5acfe589be558c7f72..b1df540928120320c3f2a8333977bf6adef98e8d 100644 --- a/Tsi1.Api/Tsi1.Api/Properties/launchSettings.json +++ b/Tsi1.Api/Tsi1.Api/Properties/launchSettings.json @@ -21,7 +21,7 @@ "commandName": "Project", "launchBrowser": true, "launchUrl": "swagger/index.html", - "applicationUrl": "https://localhost:5001;http://localhost:5000", + "applicationUrl": "http://localhost:5000", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" } diff --git a/Tsi1.Api/Tsi1.Api/Startup.cs b/Tsi1.Api/Tsi1.Api/Startup.cs index 8dd2b590986be674b348bbee1eeefc22d26c280b..91a2dfc433e0a3a64ae8da7e6f91ad569bd78567 100644 --- a/Tsi1.Api/Tsi1.Api/Startup.cs +++ b/Tsi1.Api/Tsi1.Api/Startup.cs @@ -104,7 +104,7 @@ namespace Tsi1.Api app.UseDeveloperExceptionPage(); } - app.UseHttpsRedirection(); + // app.UseHttpsRedirection(); app.UseSwagger(); app.UseSwaggerUI(c =>