Files
sor/Server/Dockerfile.host
T
b5c9385e73 Add CI/CD pipeline, Dockerfiles, and k8s/ArgoCD manifests
- Gitea Actions workflow: build sor-host + sor-admin, push to Harbor,
  auto-update image tags in k8s manifests (GitOps — ArgoCD watches deploy/k8s/)
- Dockerfile.host / Dockerfile.admin: multi-stage .NET 8 builds, non-root runtime
- deploy/k8s/: configmap, deployments, services, nginx ingress
  - hub.aeternalisgames.com → sor-host (WebSocket gateway)
  - admin.aeternalisgames.com → sor-admin (Blazor admin portal)
  - hub-tls for hub, cert-manager auto-provisions admin-tls
- deploy/secrets/: README + *.yaml.template files to populate (gitignored)
- deploy/argo/application.yaml: ArgoCD Application (namespace stone-server)
- Root .gitignore: excludes deploy/secrets/*.yaml (never commit populated secrets)

Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
2026-02-25 21:33:54 -05:00

53 lines
2.8 KiB
Docker

# ── Stage 1: Build ────────────────────────────────────────────────────────────
# Uses the full SDK image; output is a self-contained publish artifact.
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
WORKDIR /src
# Copy solution props first — these rarely change so the layer is cached.
COPY Directory.Build.props Directory.Packages.props ./
COPY SOR.slnx ./
# Copy individual csproj files so 'dotnet restore' is a separate cached layer.
# Only invalidated when a dependency changes, not when source changes.
COPY src/SOR.Host/SOR.Host.csproj src/SOR.Host/
COPY src/SOR.Auth/SOR.Auth.csproj src/SOR.Auth/
COPY src/SOR.Bazaar/SOR.Bazaar.csproj src/SOR.Bazaar/
COPY src/SOR.Cdn/SOR.Cdn.csproj src/SOR.Cdn/
COPY src/SOR.Chat/SOR.Chat.csproj src/SOR.Chat/
COPY src/SOR.Collection/SOR.Collection.csproj src/SOR.Collection/
COPY src/SOR.Content/SOR.Content.csproj src/SOR.Content/
COPY src/SOR.Database/SOR.Database.csproj src/SOR.Database/
COPY src/SOR.Gateway/SOR.Gateway.csproj src/SOR.Gateway/
COPY src/SOR.Networking.Abstractions/SOR.Networking.Abstractions.csproj src/SOR.Networking.Abstractions/
COPY src/SOR.Networking.Nats/SOR.Networking.Nats.csproj src/SOR.Networking.Nats/
COPY src/SOR.Networking.Redis/SOR.Networking.Redis.csproj src/SOR.Networking.Redis/
COPY src/SOR.Networking.WebSocket/SOR.Networking.WebSocket.csproj src/SOR.Networking.WebSocket/
COPY src/SOR.Shared/SOR.Shared.csproj src/SOR.Shared/
COPY src/SOR.Shared.Proto/SOR.Shared.Proto.csproj src/SOR.Shared.Proto/
COPY src/SOR.Versioning/SOR.Versioning.csproj src/SOR.Versioning/
RUN dotnet restore src/SOR.Host/SOR.Host.csproj
# Copy full source and publish.
COPY . .
RUN dotnet publish src/SOR.Host/SOR.Host.csproj \
-c Release \
--no-restore \
-o /app/publish
# ── Stage 2: Runtime ──────────────────────────────────────────────────────────
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS runtime
WORKDIR /app
# Run as non-root for security.
RUN adduser --disabled-password --gecos "" appuser
USER appuser
COPY --from=build --chown=appuser:appuser /app/publish .
EXPOSE 8080
ENV ASPNETCORE_URLS=http://+:8080
ENV ASPNETCORE_ENVIRONMENT=Production
ENTRYPOINT ["dotnet", "SOR.Host.dll"]