builds docker image

This commit is contained in:
benbierens 2024-09-11 14:06:48 +02:00
parent f7fa35c7ba
commit eac06e8b3a
No known key found for this signature in database
GPG Key ID: 877D2C2E09A22F3A
16 changed files with 44 additions and 6 deletions

View File

@ -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

View File

@ -3,8 +3,6 @@
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base
USER app USER app
WORKDIR /app WORKDIR /app
EXPOSE 8080
EXPOSE 8081
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
ARG BUILD_CONFIGURATION=Release ARG BUILD_CONFIGURATION=Release

View File

@ -7,6 +7,14 @@ namespace AutoClientCenter
{ {
var builder = WebApplication.CreateBuilder(args); 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<ITaskService>(new TaskService()); builder.Services.AddSingleton<ITaskService>(new TaskService());
builder.Services.AddControllers(); builder.Services.AddControllers();
builder.Services.AddEndpointsApiExplorer(); builder.Services.AddEndpointsApiExplorer();
@ -27,6 +35,8 @@ namespace AutoClientCenter
app.MapControllers(); app.MapControllers();
Console.WriteLine("AutoClientCenter listening on port " + listenPort);
app.Run(); app.Run();
} }
} }

View File

@ -3,8 +3,6 @@
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base
USER app USER app
WORKDIR /app WORKDIR /app
EXPOSE 8080
EXPOSE 8081
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
ARG BUILD_CONFIGURATION=Release ARG BUILD_CONFIGURATION=Release

View File

@ -1,6 +1,4 @@
using ArgsUniform; using ArgsUniform;
using Microsoft.Extensions.Options;
using Nethereum.Model;
using System.Reflection; using System.Reflection;
namespace MarketInsights namespace MarketInsights
@ -28,6 +26,14 @@ namespace MarketInsights
var builder = WebApplication.CreateBuilder(args); 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.AddSingleton(appState);
builder.Services.AddControllers(); builder.Services.AddControllers();
@ -54,6 +60,8 @@ namespace MarketInsights
app.MapControllers(); app.MapControllers();
Console.WriteLine("MarketInsights listening on port " + listenPort);
updater.Run(); updater.Run();
app.Run(); app.Run();
} }