From 74327eb381cf16bd5789fd140b0bade7a258bd2b Mon Sep 17 00:00:00 2001 From: Darkstack <1835601+darkstack@users.noreply.github.com> Date: Mon, 18 Mar 2019 09:58:44 +0100 Subject: [PATCH] Add docker file Changed kestrel bindings (Docker doesn't resolve loopback) --- LaDOSE.Src/.dockerignore | 2 ++ LaDOSE.Src/Dockerfile | 15 +++++++++++++++ LaDOSE.Src/LaDOSE.Api/Program.cs | 2 +- 3 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 LaDOSE.Src/.dockerignore create mode 100644 LaDOSE.Src/Dockerfile diff --git a/LaDOSE.Src/.dockerignore b/LaDOSE.Src/.dockerignore new file mode 100644 index 0000000..92316b4 --- /dev/null +++ b/LaDOSE.Src/.dockerignore @@ -0,0 +1,2 @@ +*/*/bin* +*/*/obj* diff --git a/LaDOSE.Src/Dockerfile b/LaDOSE.Src/Dockerfile new file mode 100644 index 0000000..62cbb10 --- /dev/null +++ b/LaDOSE.Src/Dockerfile @@ -0,0 +1,15 @@ +FROM microsoft/dotnet:sdk AS build-env +WORKDIR /app + +# Copy everything else and build +COPY . ./ + +RUN dotnet publish LaDOSE.linux.sln -c Release -o out + +# Build runtime image +FROM microsoft/dotnet:aspnetcore-runtime +WORKDIR /app +COPY --from=build-env /app/LaDOSE.Api/out/ . +EXPOSE 5000 +ENTRYPOINT ["dotnet", "LaDOSE.Api.dll"] + diff --git a/LaDOSE.Src/LaDOSE.Api/Program.cs b/LaDOSE.Src/LaDOSE.Api/Program.cs index fb75431..5de33ec 100644 --- a/LaDOSE.Src/LaDOSE.Api/Program.cs +++ b/LaDOSE.Src/LaDOSE.Api/Program.cs @@ -37,7 +37,7 @@ namespace LaDOSE.Api return WebHost.CreateDefaultBuilder(args) .UseContentRoot(Directory.GetCurrentDirectory()) .UseConfiguration(config) - .UseKestrel(options => options.Listen(IPAddress.Loopback,int.Parse(config["Port"]))) + .UseKestrel(options => options.Listen(IPAddress.Any,int.Parse(config["Port"]))) .UseStartup(); } }