From 0b3b898ccf6f85cd4eecee422b6937c88109b845 Mon Sep 17 00:00:00 2001 From: danielgrabowski Date: Tue, 5 Nov 2019 13:01:38 +0100 Subject: [PATCH] add dockerfiles --- .dockerignore | 25 +++++++++++++++++++ Squirrowse.Client/Program.cs | 2 +- Squirrowse.Service/Dockerfile | 21 ++++++++++++++++ .../Properties/launchSettings.json | 22 +++++++++++----- Squirrowse.Service/Squirrowse.Service.csproj | 3 +++ 5 files changed, 66 insertions(+), 7 deletions(-) create mode 100644 .dockerignore create mode 100644 Squirrowse.Service/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/Squirrowse.Client/Program.cs b/Squirrowse.Client/Program.cs index 0cad8cd..2498c3d 100644 --- a/Squirrowse.Client/Program.cs +++ b/Squirrowse.Client/Program.cs @@ -17,7 +17,7 @@ namespace Squirrowse.Client .ConfigureServices((hostContext, services) => { services.AddHostedService(); - services.AddSingleton(x=> new ConnectionManager("http://localhost", 5000)); //keep as transient for now + services.AddSingleton(x=> new ConnectionManager("http://localhost", 44366)); //keep as transient for now services.AddSingleton< ICameraService, CameraService >(x=>new CameraService(new Camera())); services.AddTransient(); diff --git a/Squirrowse.Service/Dockerfile b/Squirrowse.Service/Dockerfile new file mode 100644 index 0000000..fcba618 --- /dev/null +++ b/Squirrowse.Service/Dockerfile @@ -0,0 +1,21 @@ +FROM mcr.microsoft.com/dotnet/core/aspnet:3.0-buster-slim AS base +WORKDIR /app +EXPOSE 5000 +EXPOSE 5001 + +FROM mcr.microsoft.com/dotnet/core/sdk:3.0-buster AS build +WORKDIR /src +COPY ["Squirrowse.Service/Squirrowse.Service.csproj", "Squirrowse.Service/"] +COPY ["Squirrowse.Core/Squirrowse.Core.csproj", "Squirrowse.Core/"] +RUN dotnet restore "Squirrowse.Service/Squirrowse.Service.csproj" +COPY . . +WORKDIR "/src/Squirrowse.Service" +RUN dotnet build "Squirrowse.Service.csproj" -c Release -o /app/build + +FROM build AS publish +RUN dotnet publish "Squirrowse.Service.csproj" -c Release -o /app/publish + +FROM base AS final +WORKDIR /app +COPY --from=publish /app/publish . +ENTRYPOINT ["dotnet", "Squirrowse.Service.dll"] \ No newline at end of file diff --git a/Squirrowse.Service/Properties/launchSettings.json b/Squirrowse.Service/Properties/launchSettings.json index 78db389..ae72f7c 100644 --- a/Squirrowse.Service/Properties/launchSettings.json +++ b/Squirrowse.Service/Properties/launchSettings.json @@ -1,5 +1,4 @@ -{ - "$schema": "http://json.schemastore.org/launchsettings.json", +{ "iisSettings": { "windowsAuthentication": false, "anonymousAuthentication": true, @@ -8,11 +7,10 @@ "sslPort": 44365 } }, + "$schema": "http://json.schemastore.org/launchsettings.json", "profiles": { "IIS Express": { "commandName": "IISExpress", - "launchBrowser": false, - "launchUrl": "", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" } @@ -21,10 +19,22 @@ "commandName": "Project", "launchBrowser": true, "launchUrl": "weatherforecast", - "applicationUrl": "https://localhost:5001;http://localhost:5000", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" - } + }, + "applicationUrl": "https://localhost:5001;http://localhost:5000" + }, + "Docker": { + "commandName": "Docker", + "launchBrowser": true, + "launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}", + "environmentVariables": { + "ASPNETCORE_URLS": "https://+:443;http://+:80", + "ASPNETCORE_HTTPS_PORT": "44366" + }, + "httpPort": 59338, + "useSSL": true, + "sslPort": 44366 } } } \ No newline at end of file diff --git a/Squirrowse.Service/Squirrowse.Service.csproj b/Squirrowse.Service/Squirrowse.Service.csproj index efe8c59..7df21da 100644 --- a/Squirrowse.Service/Squirrowse.Service.csproj +++ b/Squirrowse.Service/Squirrowse.Service.csproj @@ -2,6 +2,8 @@ netcoreapp3.0 + 996aee3a-63a2-4e6b-abcd-b0c6a183af8c + Linux @@ -13,6 +15,7 @@ +