From ed4688c9e8b7bb064ae66651f54c63d6cf688b3f Mon Sep 17 00:00:00 2001 From: Denis Nutiu Date: Sun, 9 Aug 2020 12:49:36 +0300 Subject: [PATCH] NUH-40: Add Dockerfile support for NucuCar.Sensors --- NucuCar.Sensors/Dockerfile | 22 ++++++++++++++++++++++ NucuCar.Sensors/Grpc/GrpcStartup.cs | 1 - NucuCar.Sensors/appsettings.json | 4 ++-- NucuCar.TestClient/Sensors/SensorsCmd.cs | 2 +- 4 files changed, 25 insertions(+), 4 deletions(-) create mode 100644 NucuCar.Sensors/Dockerfile diff --git a/NucuCar.Sensors/Dockerfile b/NucuCar.Sensors/Dockerfile new file mode 100644 index 0000000..ad006c1 --- /dev/null +++ b/NucuCar.Sensors/Dockerfile @@ -0,0 +1,22 @@ +# To build this image use the following command: +# docker build . -f ./NucuCar/NucuCar.Sensors/Dockerfile -t NucuCar_Sensors +# To debug: docker run -it NucuCar_Sensors /bin/bash + +# STAGE 0: Build the program. +FROM mcr.microsoft.com/dotnet/core/sdk:3.1 +MAINTAINER Denis Nutiu + +# Copy the NucuHub folder into the workdir +WORKDIR /root/build +COPY . . + +RUN dotnet build --configuration Release -o dist + +# STAGE 1: Run the program. +FROM mcr.microsoft.com/dotnet/core/aspnet:3.1 + +# Copy the built program into workdir. +WORKDIR /root/app +COPY --from=0 /root/build/dist/ . + +CMD /root/app/NucuCar.Sensors diff --git a/NucuCar.Sensors/Grpc/GrpcStartup.cs b/NucuCar.Sensors/Grpc/GrpcStartup.cs index e26205b..fe40ae3 100644 --- a/NucuCar.Sensors/Grpc/GrpcStartup.cs +++ b/NucuCar.Sensors/Grpc/GrpcStartup.cs @@ -26,7 +26,6 @@ namespace NucuCar.Sensors.Grpc } app.UseRouting(); - app.UseHttpsRedirection(); app.UseEndpoints(endpoints => { diff --git a/NucuCar.Sensors/appsettings.json b/NucuCar.Sensors/appsettings.json index aa114ce..db3c6b1 100644 --- a/NucuCar.Sensors/appsettings.json +++ b/NucuCar.Sensors/appsettings.json @@ -28,8 +28,8 @@ "Protocols": "Http2" }, "EndPoints": { - "Https": { - "Url": "https://0.0.0.0:8000" + "Http": { + "Url": "http://0.0.0.0:8000" } } } diff --git a/NucuCar.TestClient/Sensors/SensorsCmd.cs b/NucuCar.TestClient/Sensors/SensorsCmd.cs index ae35520..d892274 100644 --- a/NucuCar.TestClient/Sensors/SensorsCmd.cs +++ b/NucuCar.TestClient/Sensors/SensorsCmd.cs @@ -18,7 +18,7 @@ namespace NucuCar.TestClient.Sensors public class SensorsCmdOptions { [Option('u', "url", Required = false, HelpText = "The url and port of the gRPC server.", - Default = "https://localhost:8000")] + Default = "http://localhost:8000")] public string GrpcServiceAddress { get; set; } [Option('s', "sensor", Required = false, HelpText = "The sensor name you'd like to test.",