From e16bc597c6fd4ba7223ed2db18580d271aee80ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Furkan=20G=C3=BCng=C3=B6r?= Date: Thu, 5 Aug 2021 18:01:06 +0300 Subject: [PATCH] =?UTF-8?q?=E2=9B=8F=20Add=20docker=20file?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .dockerignore | 25 +++++++++++++++++++ Dockerfile | 25 +++++++++++++++++++ samples/IronHook.Web/IronHook.Web.csproj | 4 +++ .../Properties/launchSettings.json | 17 +++++++++---- 4 files changed, 66 insertions(+), 5 deletions(-) create mode 100644 .dockerignore create mode 100644 Dockerfile diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..3729ff0 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,25 @@ +**/.classpath +**/.dockerignore +**/.env +**/.git +**/.gitignore +**/.project +**/.settings +**/.toolstarget +**/.vs +**/.vscode +**/*.*proj.user +**/*.dbmdl +**/*.jfm +**/azds.yaml +**/bin +**/charts +**/docker-compose* +**/Dockerfile* +**/node_modules +**/npm-debug.log +**/obj +**/secrets.dev.yaml +**/values.dev.yaml +LICENSE +README.md \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..d62e0fa --- /dev/null +++ b/Dockerfile @@ -0,0 +1,25 @@ +#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging. + +FROM mcr.microsoft.com/dotnet/aspnet:5.0 AS base +WORKDIR /app +EXPOSE 80 +EXPOSE 443 + +FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build +WORKDIR /src +COPY ["samples/IronHook.Web/IronHook.Web.csproj", "samples/IronHook.Web/"] +COPY ["src/IronHook.PostgreSql/IronHook.PostgreSql.csproj", "src/IronHook.PostgreSql/"] +COPY ["src/IronHook.EntityFrameworkCore/IronHook.EntityFrameworkCore.csproj", "src/IronHook.EntityFrameworkCore/"] +COPY ["src/IronHook.Core/IronHook.Core.csproj", "src/IronHook.Core/"] +RUN dotnet restore "samples/IronHook.Web/IronHook.Web.csproj" +COPY . . +WORKDIR "/src/samples/IronHook.Web" +RUN dotnet build "IronHook.Web.csproj" -c Release -o /app/build + +FROM build AS publish +RUN dotnet publish "IronHook.Web.csproj" -c Release -o /app/publish + +FROM base AS final +WORKDIR /app +COPY --from=publish /app/publish . +CMD ASPNETCORE_URLS=http://*:$PORT dotnet IronHook.Web.dll \ No newline at end of file diff --git a/samples/IronHook.Web/IronHook.Web.csproj b/samples/IronHook.Web/IronHook.Web.csproj index 21fbbdc..5066d3d 100644 --- a/samples/IronHook.Web/IronHook.Web.csproj +++ b/samples/IronHook.Web/IronHook.Web.csproj @@ -2,6 +2,9 @@ net5.0 + 63f74f68-04e1-4eae-9e39-cf946ac88d11 + Linux + ..\.. @@ -15,6 +18,7 @@ + all diff --git a/samples/IronHook.Web/Properties/launchSettings.json b/samples/IronHook.Web/Properties/launchSettings.json index 0db059c..a1404d8 100644 --- a/samples/IronHook.Web/Properties/launchSettings.json +++ b/samples/IronHook.Web/Properties/launchSettings.json @@ -1,4 +1,4 @@ -{ +{ "iisSettings": { "windowsAuthentication": false, "anonymousAuthentication": true, @@ -17,12 +17,19 @@ }, "IronHook.Web": { "commandName": "Project", - "dotnetRunMessages": "true", "launchBrowser": true, - "applicationUrl": "https://localhost:5001;http://localhost:5000", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" - } + }, + "dotnetRunMessages": "true", + "applicationUrl": "https://localhost:5001;http://localhost:5000" + }, + "Docker": { + "commandName": "Docker", + "launchBrowser": true, + "launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}", + "publishAllPorts": true, + "useSSL": true } } -} +} \ No newline at end of file