tiny-refactors #27
3
.dockerignore
Normal file
3
.dockerignore
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
**/bin
|
||||||
|
**/obj
|
||||||
|
**/Dockerfile
|
||||||
23
Apps/Website/Dockerfile
Normal file
23
Apps/Website/Dockerfile
Normal 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"]
|
||||||
@ -1,3 +1,4 @@
|
|||||||
|
using System;
|
||||||
using Microsoft.AspNetCore.Hosting;
|
using Microsoft.AspNetCore.Hosting;
|
||||||
using Microsoft.Extensions.Hosting;
|
using Microsoft.Extensions.Hosting;
|
||||||
|
|
||||||
@ -14,6 +15,7 @@ namespace Website
|
|||||||
Host.CreateDefaultBuilder(args)
|
Host.CreateDefaultBuilder(args)
|
||||||
.ConfigureWebHostDefaults(webBuilder =>
|
.ConfigureWebHostDefaults(webBuilder =>
|
||||||
{
|
{
|
||||||
|
webBuilder.UseUrls($"http://0.0.0.0:{Environment.GetEnvironmentVariable("PORT") ?? "5000"}");
|
||||||
webBuilder.UseStartup<Startup>();
|
webBuilder.UseStartup<Startup>();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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.
|
// 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.UseHsts();
|
||||||
}
|
}
|
||||||
app.UseHttpsRedirection();
|
// app.UseHttpsRedirection();
|
||||||
app.UseStaticFiles();
|
app.UseStaticFiles();
|
||||||
|
|
||||||
app.UseRouting();
|
app.UseRouting();
|
||||||
|
|||||||
@ -166,3 +166,9 @@ project.csproj
|
|||||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||||
<DocumentationFile>bin\YourApi.XML</DocumentationFile>
|
<DocumentationFile>bin\YourApi.XML</DocumentationFile>
|
||||||
</PropertyGroup>
|
</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`.
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user