tiny-refactors #27

Merged
jleicher merged 4 commits from tiny-refactors into master 2020-12-17 12:01:12 +01:00
5 changed files with 35 additions and 1 deletions
Showing only changes of commit 6c3b9f2601 - Show all commits

3
.dockerignore Normal file
View File

@ -0,0 +1,3 @@
**/bin
**/obj
**/Dockerfile

23
Apps/Website/Dockerfile Normal file
View File

@ -0,0 +1,23 @@
FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build
WORKDIR /source
COPY *.sln .
COPY Application/*.csproj ./Application/
COPY Domain/*.csproj ./Domain/
COPY Infrastructure/*.csproj ./Infrastructure/
COPY Apps/Website/*.csproj ./Apps/Website/
RUN dotnet restore
COPY Application/. ./Application/
COPY Domain/. ./Domain/
COPY Infrastructure/. ./Infrastructure/
COPY Apps/Website/. ./Apps/Website/
WORKDIR /source/Apps/Website
RUN dotnet publish -c release -o /app --no-restore
FROM mcr.microsoft.com/dotnet/aspnet:5.0
WORKDIR /app
COPY --from=build /app ./
EXPOSE 80
ENTRYPOINT ["dotnet", "Website.dll"]

View File

@ -1,3 +1,4 @@
using System;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Hosting;
@ -14,6 +15,7 @@ namespace Website
Host.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder.UseUrls($"http://0.0.0.0:{Environment.GetEnvironmentVariable("PORT") ?? "5000"}");
webBuilder.UseStartup<Startup>();
});
}

View File

@ -78,7 +78,7 @@ namespace Website
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
app.UseHsts();
}
app.UseHttpsRedirection();
// app.UseHttpsRedirection();
app.UseStaticFiles();
app.UseRouting();

View File

@ -166,3 +166,9 @@ project.csproj
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<DocumentationFile>bin\YourApi.XML</DocumentationFile>
</PropertyGroup>
## Docker
On build à la racine de la solution avec `docker build -f .\Apps\Website\Dockerfile -t hn .`.
Et on lance avec `docker run -it --rm -p "8000:80" hn`.