chore: initial

This commit is contained in:
willem.serruys
2025-12-29 05:32:16 +01:00
parent d60a975389
commit 50d5279317
5 changed files with 89 additions and 0 deletions

7
.gitignore vendored
View File

@@ -8,3 +8,10 @@ configuration-production.yaml
node_modules/ node_modules/
config/ config/
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
[Oo]bj/

View File

@@ -132,6 +132,10 @@ services:
restart: unless-stopped restart: unless-stopped
volumes: volumes:
- ${REPO_DIR}/configurations/otel/collector-config.yaml:/etc/otelcol-contrib/config.yaml - ${REPO_DIR}/configurations/otel/collector-config.yaml:/etc/otelcol-contrib/config.yaml
power_control:
build:
context: .
dockerfile: ./dockerfiles/power_control.Dockerfile
# Only enable if external services present # Only enable if external services present
# ports: # ports:
# - 4317:4317 # OTLP gRPC receiver # - 4317:4317 # OTLP gRPC receiver

View File

@@ -0,0 +1,24 @@
FROM mcr.microsoft.com/dotnet/aspnet:10.0.101-noble-arm64v8 AS base
USER $APP_UID
EXPOSE 8080
FROM mcr.microsoft.com/dotnet/sdk:10.0.101-noble-arm64v8 AS build
COPY ./microservices/power_control/*.csproj /microservices/power_control/
WORKDIR /microservices/power_control
RUN dotnet restore
WORKDIR /
COPY ./microservices/power_control /microservices/power_control
WORKDIR /microservices/power_control
# This stage is used to publish the service project to be copied to the final stage
FROM build AS publish
ARG BUILD_CONFIGURATION
RUN dotnet publish "./power_control.csproj" -c Release -o /app/publish
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "power_control.dll"]

View File

@@ -0,0 +1,41 @@
var builder = WebApplication.CreateBuilder(args);
// Add services to the container.
// Learn more about configuring OpenAPI at https://aka.ms/aspnet/openapi
builder.Services.AddOpenApi();
var app = builder.Build();
// Configure the HTTP request pipeline.
if (app.Environment.IsDevelopment())
{
app.MapOpenApi();
}
app.UseHttpsRedirection();
var summaries = new[]
{
"Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
};
app.MapGet("/weatherforecast", () =>
{
var forecast = Enumerable.Range(1, 5).Select(index =>
new WeatherForecast
(
DateOnly.FromDateTime(DateTime.Now.AddDays(index)),
Random.Shared.Next(-20, 55),
summaries[Random.Shared.Next(summaries.Length)]
))
.ToArray();
return forecast;
})
.WithName("GetWeatherForecast");
app.Run();
record WeatherForecast(DateOnly Date, int TemperatureC, string? Summary)
{
public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);
}

View File

@@ -0,0 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="9.0.0" />
</ItemGroup>
</Project>