diff --git a/.github/workflows/deploy.prod-env.yml b/.github/workflows/deploy.prod-env.yml index 2339d78..5033a53 100644 --- a/.github/workflows/deploy.prod-env.yml +++ b/.github/workflows/deploy.prod-env.yml @@ -26,5 +26,5 @@ jobs: docker pull git.wohlleben.dev/itob/rbl-news-webapp:latest docker stop rbl-news-webapp docker rm rbl-news-webapp - docker run --init -d --name rbl-news-webapp -p 8000:8080 -e RblApiUrl=${{ vars.RBL_PROD_ENV_API_URL }} --restart=always git.wohlleben.dev/itob/rbl-news-webapp:latest + docker run --init -d --name rbl-news-webapp -p 8000:8080 -e ASPNETCORE_ENVIRONMENT=Production --restart=always git.wohlleben.dev/itob/rbl-news-webapp:latest docker system prune -af \ No newline at end of file diff --git a/.github/workflows/deploy.test-env.yml b/.github/workflows/deploy.test-env.yml index d53d4b2..4e4327b 100644 --- a/.github/workflows/deploy.test-env.yml +++ b/.github/workflows/deploy.test-env.yml @@ -39,5 +39,5 @@ jobs: docker pull git.wohlleben.dev/itob/rbl-news-webapp:latest docker stop rbl-news-webapp docker rm rbl-news-webapp - docker run --init -d --name rbl-news-webapp -p 8000:8080 -e RblApiUrl=${{ vars.RBL_TEST_ENV_API_URL }} --restart=always git.wohlleben.dev/itob/rbl-news-webapp:latest + docker run --init -d --name rbl-news-webapp -p 8000:8080 -e ASPNETCORE_ENVIRONMENT=Test --restart=always git.wohlleben.dev/itob/rbl-news-webapp:latest docker system prune -af \ No newline at end of file diff --git a/IaC/RBLNews.Web/Dockerfile b/IaC/RBLNews.Web/Dockerfile index 6a309ec..d8f7f22 100644 --- a/IaC/RBLNews.Web/Dockerfile +++ b/IaC/RBLNews.Web/Dockerfile @@ -3,9 +3,6 @@ WORKDIR /app EXPOSE 80 EXPOSE 8080 EXPOSE 443 -#ARG docker_external_http_port -#ENV ASPNETCORE_URLS=http://+:docker_external_http_port - FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build ARG BUILD_CONFIGURATION=Release WORKDIR /src diff --git a/RBLNews.Shared/RBLNews.Shared.csproj b/RBLNews.Shared/RBLNews.Shared.csproj index b6d1027..ea85a54 100644 --- a/RBLNews.Shared/RBLNews.Shared.csproj +++ b/RBLNews.Shared/RBLNews.Shared.csproj @@ -20,4 +20,19 @@ + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + diff --git a/RBLNews.Web/appsettings.Development.json b/RBLNews.Shared/wwwroot/appsettings.Development.json similarity index 100% rename from RBLNews.Web/appsettings.Development.json rename to RBLNews.Shared/wwwroot/appsettings.Development.json diff --git a/RBLNews.Web/appsettings.Production.json b/RBLNews.Shared/wwwroot/appsettings.Production.json similarity index 100% rename from RBLNews.Web/appsettings.Production.json rename to RBLNews.Shared/wwwroot/appsettings.Production.json diff --git a/RBLNews.Web/appsettings.Test.json b/RBLNews.Shared/wwwroot/appsettings.Test.json similarity index 100% rename from RBLNews.Web/appsettings.Test.json rename to RBLNews.Shared/wwwroot/appsettings.Test.json diff --git a/RBLNews.Web/appsettings.json b/RBLNews.Shared/wwwroot/appsettings.json similarity index 100% rename from RBLNews.Web/appsettings.json rename to RBLNews.Shared/wwwroot/appsettings.json diff --git a/RBLNews.Web/Program.cs b/RBLNews.Web/Program.cs index 119fa32..38aa526 100644 --- a/RBLNews.Web/Program.cs +++ b/RBLNews.Web/Program.cs @@ -15,6 +15,9 @@ builder.Services.AddSingleton(); builder.Services.AddSingleton(); builder.Services.AddSingleton(); +// required for production +builder.WebHost.UseStaticWebAssets(); + var app = builder.Build(); // Configure the HTTP request pipeline. diff --git a/RBLNews.Web/Properties/launchSettings.json b/RBLNews.Web/Properties/launchSettings.json index b5991ff..42b81b2 100644 --- a/RBLNews.Web/Properties/launchSettings.json +++ b/RBLNews.Web/Properties/launchSettings.json @@ -21,16 +21,25 @@ "https (DEV)": { "commandName": "Project", "dotnetRunMessages": true, - "launchBrowser": true, + "launchBrowser": false, "applicationUrl": "https://localhost:7158;http://localhost:5289", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" } }, + "https (TEST)": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": false, + "applicationUrl": "https://localhost:7158;http://localhost:5289", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Test" + } + }, "https (PROD)": { "commandName": "Project", "dotnetRunMessages": true, - "launchBrowser": true, + "launchBrowser": false, "applicationUrl": "https://localhost:7158;http://localhost:5289", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Production" diff --git a/RBLNews.Web/RBLNews.Web.csproj b/RBLNews.Web/RBLNews.Web.csproj index a259a0c..baee8a5 100644 --- a/RBLNews.Web/RBLNews.Web.csproj +++ b/RBLNews.Web/RBLNews.Web.csproj @@ -19,6 +19,18 @@ Always + + appsettings.Development.json + + + appsettings.json + + + appsettings.Production.json + + + appsettings.Test.json +