From eac06e8b3a7f6bb893b5838fbc06d6936a6b42fb Mon Sep 17 00:00:00 2001 From: benbierens Date: Wed, 11 Sep 2024 14:06:48 +0200 Subject: [PATCH] builds docker image --- .github/workflows/docker-autoclientcenter.yml | 24 +++++++++++++++++++ .../AutoClientCenter}/AutoClientCenter.csproj | 0 .../AutoClientCenter.csproj.user | 0 .../AutoClientCenter}/AutoClientCenter.http | 0 .../AutoClientCenter}/CidRepo.cs | 0 .../Controllers/ConfigController.cs | 0 .../Controllers/TasksController.cs | 0 .../AutoClientCenter}/Dockerfile | 2 -- .../AutoClientCenter}/Model.cs | 0 .../AutoClientCenter}/Program.cs | 10 ++++++++ .../Properties/launchSettings.json | 0 .../AutoClientCenter}/TaskService.cs | 0 .../appsettings.Development.json | 0 .../AutoClientCenter}/appsettings.json | 0 Tools/MarketInsights/Dockerfile | 2 -- Tools/MarketInsights/Program.cs | 12 ++++++++-- 16 files changed, 44 insertions(+), 6 deletions(-) create mode 100644 .github/workflows/docker-autoclientcenter.yml rename {AutoClientCenter => Tools/AutoClientCenter}/AutoClientCenter.csproj (100%) rename {AutoClientCenter => Tools/AutoClientCenter}/AutoClientCenter.csproj.user (100%) rename {AutoClientCenter => Tools/AutoClientCenter}/AutoClientCenter.http (100%) rename {AutoClientCenter => Tools/AutoClientCenter}/CidRepo.cs (100%) rename {AutoClientCenter => Tools/AutoClientCenter}/Controllers/ConfigController.cs (100%) rename {AutoClientCenter => Tools/AutoClientCenter}/Controllers/TasksController.cs (100%) rename {AutoClientCenter => Tools/AutoClientCenter}/Dockerfile (92%) rename {AutoClientCenter => Tools/AutoClientCenter}/Model.cs (100%) rename {AutoClientCenter => Tools/AutoClientCenter}/Program.cs (65%) rename {AutoClientCenter => Tools/AutoClientCenter}/Properties/launchSettings.json (100%) rename {AutoClientCenter => Tools/AutoClientCenter}/TaskService.cs (100%) rename {AutoClientCenter => Tools/AutoClientCenter}/appsettings.Development.json (100%) rename {AutoClientCenter => Tools/AutoClientCenter}/appsettings.json (100%) diff --git a/.github/workflows/docker-autoclientcenter.yml b/.github/workflows/docker-autoclientcenter.yml new file mode 100644 index 0000000..4e797cb --- /dev/null +++ b/.github/workflows/docker-autoclientcenter.yml @@ -0,0 +1,24 @@ +name: Docker - AutoClientCenter + +on: + push: + branches: + - master + tags: + - 'v*.*.*' + paths: + - 'Tools/AutoClientCenter/**' + - '!Tools/AutoClientCenter/Dockerfile' + - .github/workflows/docker-autoclientcenter.yml + - .github/workflows/docker-reusable.yml + workflow_dispatch: + +jobs: + build-and-push: + name: Build and Push + uses: ./.github/workflows/docker-reusable.yml + with: + docker_file: Tools/AutoClientCenter/Dockerfile + docker_repo: codexstorage/codex-autoclientcenter + secrets: inherit + diff --git a/AutoClientCenter/AutoClientCenter.csproj b/Tools/AutoClientCenter/AutoClientCenter.csproj similarity index 100% rename from AutoClientCenter/AutoClientCenter.csproj rename to Tools/AutoClientCenter/AutoClientCenter.csproj diff --git a/AutoClientCenter/AutoClientCenter.csproj.user b/Tools/AutoClientCenter/AutoClientCenter.csproj.user similarity index 100% rename from AutoClientCenter/AutoClientCenter.csproj.user rename to Tools/AutoClientCenter/AutoClientCenter.csproj.user diff --git a/AutoClientCenter/AutoClientCenter.http b/Tools/AutoClientCenter/AutoClientCenter.http similarity index 100% rename from AutoClientCenter/AutoClientCenter.http rename to Tools/AutoClientCenter/AutoClientCenter.http diff --git a/AutoClientCenter/CidRepo.cs b/Tools/AutoClientCenter/CidRepo.cs similarity index 100% rename from AutoClientCenter/CidRepo.cs rename to Tools/AutoClientCenter/CidRepo.cs diff --git a/AutoClientCenter/Controllers/ConfigController.cs b/Tools/AutoClientCenter/Controllers/ConfigController.cs similarity index 100% rename from AutoClientCenter/Controllers/ConfigController.cs rename to Tools/AutoClientCenter/Controllers/ConfigController.cs diff --git a/AutoClientCenter/Controllers/TasksController.cs b/Tools/AutoClientCenter/Controllers/TasksController.cs similarity index 100% rename from AutoClientCenter/Controllers/TasksController.cs rename to Tools/AutoClientCenter/Controllers/TasksController.cs diff --git a/AutoClientCenter/Dockerfile b/Tools/AutoClientCenter/Dockerfile similarity index 92% rename from AutoClientCenter/Dockerfile rename to Tools/AutoClientCenter/Dockerfile index 4f8996e..9fa6897 100644 --- a/AutoClientCenter/Dockerfile +++ b/Tools/AutoClientCenter/Dockerfile @@ -3,8 +3,6 @@ FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base USER app WORKDIR /app -EXPOSE 8080 -EXPOSE 8081 FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build ARG BUILD_CONFIGURATION=Release diff --git a/AutoClientCenter/Model.cs b/Tools/AutoClientCenter/Model.cs similarity index 100% rename from AutoClientCenter/Model.cs rename to Tools/AutoClientCenter/Model.cs diff --git a/AutoClientCenter/Program.cs b/Tools/AutoClientCenter/Program.cs similarity index 65% rename from AutoClientCenter/Program.cs rename to Tools/AutoClientCenter/Program.cs index c2aeec7..2d1f1fb 100644 --- a/AutoClientCenter/Program.cs +++ b/Tools/AutoClientCenter/Program.cs @@ -7,6 +7,14 @@ namespace AutoClientCenter { var builder = WebApplication.CreateBuilder(args); + var listenPort = Environment.GetEnvironmentVariable("APIPORT"); + if (string.IsNullOrEmpty(listenPort)) listenPort = "31090"; + + builder.WebHost.ConfigureKestrel((context, options) => + { + options.ListenAnyIP(Convert.ToInt32(listenPort)); + }); + builder.Services.AddSingleton(new TaskService()); builder.Services.AddControllers(); builder.Services.AddEndpointsApiExplorer(); @@ -27,6 +35,8 @@ namespace AutoClientCenter app.MapControllers(); + Console.WriteLine("AutoClientCenter listening on port " + listenPort); + app.Run(); } } diff --git a/AutoClientCenter/Properties/launchSettings.json b/Tools/AutoClientCenter/Properties/launchSettings.json similarity index 100% rename from AutoClientCenter/Properties/launchSettings.json rename to Tools/AutoClientCenter/Properties/launchSettings.json diff --git a/AutoClientCenter/TaskService.cs b/Tools/AutoClientCenter/TaskService.cs similarity index 100% rename from AutoClientCenter/TaskService.cs rename to Tools/AutoClientCenter/TaskService.cs diff --git a/AutoClientCenter/appsettings.Development.json b/Tools/AutoClientCenter/appsettings.Development.json similarity index 100% rename from AutoClientCenter/appsettings.Development.json rename to Tools/AutoClientCenter/appsettings.Development.json diff --git a/AutoClientCenter/appsettings.json b/Tools/AutoClientCenter/appsettings.json similarity index 100% rename from AutoClientCenter/appsettings.json rename to Tools/AutoClientCenter/appsettings.json diff --git a/Tools/MarketInsights/Dockerfile b/Tools/MarketInsights/Dockerfile index bdecb0f..73f0e46 100644 --- a/Tools/MarketInsights/Dockerfile +++ b/Tools/MarketInsights/Dockerfile @@ -3,8 +3,6 @@ FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base USER app WORKDIR /app -EXPOSE 8080 -EXPOSE 8081 FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build ARG BUILD_CONFIGURATION=Release diff --git a/Tools/MarketInsights/Program.cs b/Tools/MarketInsights/Program.cs index 2a10e5e..a616386 100644 --- a/Tools/MarketInsights/Program.cs +++ b/Tools/MarketInsights/Program.cs @@ -1,6 +1,4 @@ using ArgsUniform; -using Microsoft.Extensions.Options; -using Nethereum.Model; using System.Reflection; namespace MarketInsights @@ -28,6 +26,14 @@ namespace MarketInsights var builder = WebApplication.CreateBuilder(args); + var listenPort = Environment.GetEnvironmentVariable("APIPORT"); + if (string.IsNullOrEmpty(listenPort)) listenPort = "31090"; + + builder.WebHost.ConfigureKestrel((context, options) => + { + options.ListenAnyIP(Convert.ToInt32(listenPort)); + }); + builder.Services.AddSingleton(appState); builder.Services.AddControllers(); @@ -54,6 +60,8 @@ namespace MarketInsights app.MapControllers(); + Console.WriteLine("MarketInsights listening on port " + listenPort); + updater.Run(); app.Run(); }