umbau auf enviroment appsettings
All checks were successful
Restart Docker Container on Production / build (pull_request) Successful in 3m27s

This commit is contained in:
Tobias Wohlleben 2024-09-24 22:53:19 +02:00
parent 20f9454f80
commit c7f81e2172
11 changed files with 43 additions and 7 deletions

View File

@ -26,5 +26,5 @@ jobs:
docker pull git.wohlleben.dev/itob/rbl-news-webapp:latest docker pull git.wohlleben.dev/itob/rbl-news-webapp:latest
docker stop rbl-news-webapp docker stop rbl-news-webapp
docker rm 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 docker system prune -af

View File

@ -39,5 +39,5 @@ jobs:
docker pull git.wohlleben.dev/itob/rbl-news-webapp:latest docker pull git.wohlleben.dev/itob/rbl-news-webapp:latest
docker stop rbl-news-webapp docker stop rbl-news-webapp
docker rm 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 docker system prune -af

View File

@ -3,9 +3,6 @@ WORKDIR /app
EXPOSE 80 EXPOSE 80
EXPOSE 8080 EXPOSE 8080
EXPOSE 443 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 FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
ARG BUILD_CONFIGURATION=Release ARG BUILD_CONFIGURATION=Release
WORKDIR /src WORKDIR /src

View File

@ -20,4 +20,19 @@
<PackageReference Include="RBLFeederCommon" Version="1.0.0" /> <PackageReference Include="RBLFeederCommon" Version="1.0.0" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<Content Update="wwwroot\appsettings.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Update="wwwroot\appsettings.Development.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Update="wwwroot\appsettings.Production.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Update="wwwroot\appsettings.Test.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
</Project> </Project>

View File

@ -15,6 +15,9 @@ builder.Services.AddSingleton<IConfigService, ConfigService>();
builder.Services.AddSingleton<IFeedDataService, FeedDataService>(); builder.Services.AddSingleton<IFeedDataService, FeedDataService>();
builder.Services.AddSingleton<AppLifecycleService>(); builder.Services.AddSingleton<AppLifecycleService>();
// required for production
builder.WebHost.UseStaticWebAssets();
var app = builder.Build(); var app = builder.Build();
// Configure the HTTP request pipeline. // Configure the HTTP request pipeline.

View File

@ -21,16 +21,25 @@
"https (DEV)": { "https (DEV)": {
"commandName": "Project", "commandName": "Project",
"dotnetRunMessages": true, "dotnetRunMessages": true,
"launchBrowser": true, "launchBrowser": false,
"applicationUrl": "https://localhost:7158;http://localhost:5289", "applicationUrl": "https://localhost:7158;http://localhost:5289",
"environmentVariables": { "environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development" "ASPNETCORE_ENVIRONMENT": "Development"
} }
}, },
"https (TEST)": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": false,
"applicationUrl": "https://localhost:7158;http://localhost:5289",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Test"
}
},
"https (PROD)": { "https (PROD)": {
"commandName": "Project", "commandName": "Project",
"dotnetRunMessages": true, "dotnetRunMessages": true,
"launchBrowser": true, "launchBrowser": false,
"applicationUrl": "https://localhost:7158;http://localhost:5289", "applicationUrl": "https://localhost:7158;http://localhost:5289",
"environmentVariables": { "environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Production" "ASPNETCORE_ENVIRONMENT": "Production"

View File

@ -19,6 +19,18 @@
<Content Update="wwwroot\fonts\NanumMyeongjo-Regular.ttf"> <Content Update="wwwroot\fonts\NanumMyeongjo-Regular.ttf">
<CopyToOutputDirectory>Always</CopyToOutputDirectory> <CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content> </Content>
<Content Include="..\RBLNews.Shared\wwwroot\appsettings.Development.json">
<Link>appsettings.Development.json</Link>
</Content>
<Content Include="..\RBLNews.Shared\wwwroot\appsettings.json">
<Link>appsettings.json</Link>
</Content>
<Content Include="..\RBLNews.Shared\wwwroot\appsettings.Production.json">
<Link>appsettings.Production.json</Link>
</Content>
<Content Include="..\RBLNews.Shared\wwwroot\appsettings.Test.json">
<Link>appsettings.Test.json</Link>
</Content>
</ItemGroup> </ItemGroup>
</Project> </Project>