chore(thalos-service): add container run assets
Why: align service runtime packaging and health endpoints for container execution. What: add Docker build assets, container runbook, and dual health mappings with explicit http/grpc ports. Rule: keep technical intent only and avoid orchestration references.
This commit is contained in:
parent
201ef3e599
commit
fedd26bce6
9
.dockerignore
Normal file
9
.dockerignore
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
**/bin/
|
||||||
|
**/obj/
|
||||||
|
.vs/
|
||||||
|
TestResults/
|
||||||
|
.git/
|
||||||
|
.repo-tasks/
|
||||||
|
.repo-context/
|
||||||
|
.tasks/
|
||||||
|
.agile/
|
||||||
23
Dockerfile
Normal file
23
Dockerfile
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
# syntax=docker/dockerfile:1.7
|
||||||
|
ARG SDK_IMAGE=mcr.microsoft.com/dotnet/sdk:10.0
|
||||||
|
ARG RUNTIME_IMAGE=mcr.microsoft.com/dotnet/aspnet:10.0
|
||||||
|
|
||||||
|
FROM ${SDK_IMAGE} AS build
|
||||||
|
ARG NUGET_FEED_URL=http://192.168.10.100:3000/api/packages/AgileWebs/nuget/index.json
|
||||||
|
ARG NUGET_FEED_USERNAME=
|
||||||
|
ARG NUGET_FEED_TOKEN=
|
||||||
|
WORKDIR /src
|
||||||
|
COPY . .
|
||||||
|
|
||||||
|
RUN if [ -n "$NUGET_FEED_USERNAME" ] && [ -n "$NUGET_FEED_TOKEN" ]; then dotnet nuget add source "$NUGET_FEED_URL" --name gitea-org --username "$NUGET_FEED_USERNAME" --password "$NUGET_FEED_TOKEN" --store-password-in-clear-text --allow-insecure-connections --configfile /root/.nuget/NuGet/NuGet.Config; fi
|
||||||
|
|
||||||
|
RUN dotnet restore "src/Thalos.Service.Grpc/Thalos.Service.Grpc.csproj" --configfile /root/.nuget/NuGet/NuGet.Config
|
||||||
|
RUN dotnet publish "src/Thalos.Service.Grpc/Thalos.Service.Grpc.csproj" -c Release -o /app/publish /p:UseAppHost=false --no-restore
|
||||||
|
|
||||||
|
FROM ${RUNTIME_IMAGE} AS runtime
|
||||||
|
WORKDIR /app
|
||||||
|
ENV ASPNETCORE_ENVIRONMENT=Production
|
||||||
|
EXPOSE 8080
|
||||||
|
EXPOSE 8081
|
||||||
|
COPY --from=build /app/publish .
|
||||||
|
ENTRYPOINT ["dotnet", "Thalos.Service.Grpc.dll"]
|
||||||
25
docs/runbooks/containerization.md
Normal file
25
docs/runbooks/containerization.md
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
# Containerization Runbook
|
||||||
|
|
||||||
|
## Image Build
|
||||||
|
|
||||||
|
If the repo consumes internal packages from Gitea, pass feed credentials as build args.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker build --build-arg NUGET_FEED_USERNAME=<gitea-login> --build-arg NUGET_FEED_TOKEN=<gitea-token> -t agilewebs/thalos-service:dev .
|
||||||
|
```
|
||||||
|
|
||||||
|
## Local Run
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker run --rm -p 8080:8080 --name thalos-service agilewebs/thalos-service:dev
|
||||||
|
```
|
||||||
|
|
||||||
|
## Health Probe
|
||||||
|
|
||||||
|
- Path: `/health`
|
||||||
|
- Fallback path: `/healthz`
|
||||||
|
- Port: `8080`
|
||||||
|
|
||||||
|
## Runtime Notes
|
||||||
|
|
||||||
|
- Exposes internal identity runtime endpoint set and gRPC service.
|
||||||
@ -1,7 +1,16 @@
|
|||||||
using Thalos.Service.Application.DependencyInjection;
|
using Thalos.Service.Application.DependencyInjection;
|
||||||
using Thalos.Service.Grpc.Services;
|
using Thalos.Service.Grpc.Services;
|
||||||
|
using Microsoft.AspNetCore.Server.Kestrel.Core;
|
||||||
|
|
||||||
var builder = WebApplication.CreateBuilder(args);
|
var builder = WebApplication.CreateBuilder(args);
|
||||||
|
var httpPort = builder.Configuration.GetValue("ThalosService:HttpPort", 8080);
|
||||||
|
var grpcPort = builder.Configuration.GetValue("ThalosService:GrpcPort", 8081);
|
||||||
|
|
||||||
|
builder.WebHost.ConfigureKestrel(options =>
|
||||||
|
{
|
||||||
|
options.ListenAnyIP(httpPort, listenOptions => listenOptions.Protocols = HttpProtocols.Http1);
|
||||||
|
options.ListenAnyIP(grpcPort, listenOptions => listenOptions.Protocols = HttpProtocols.Http2);
|
||||||
|
});
|
||||||
|
|
||||||
builder.Services.AddGrpc();
|
builder.Services.AddGrpc();
|
||||||
builder.Services.AddHealthChecks();
|
builder.Services.AddHealthChecks();
|
||||||
@ -11,5 +20,6 @@ var app = builder.Build();
|
|||||||
|
|
||||||
app.MapGrpcService<IdentityRuntimeGrpcService>();
|
app.MapGrpcService<IdentityRuntimeGrpcService>();
|
||||||
app.MapHealthChecks("/healthz");
|
app.MapHealthChecks("/healthz");
|
||||||
|
app.MapHealthChecks("/health");
|
||||||
|
|
||||||
app.Run();
|
app.Run();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user