feat(website): add Dockerfile.website

Multi-stage build matching Dockerfile.admin pattern:
- Stage 1: restore only changed .csproj files (layer cache),
  then publish Release build
- Stage 2: aspnet:8.0 runtime, non-root appuser, port 8080

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>
This commit is contained in:
dingo
2026-04-22 19:51:04 -04:00
co-authored by Claude Happy
parent c972b8687e
commit aaab114a3e
+37
View File
@@ -0,0 +1,37 @@
# ── Stage 1: Build ────────────────────────────────────────────────────────────
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
WORKDIR /src
COPY Directory.Build.props Directory.Packages.props ./
COPY SOR.slnx ./
# Copy only the .csproj files first so Docker can cache the restore layer.
# Restore is re-run only when a .csproj or Directory.Packages.props changes.
COPY src/SOR.Website/SOR.Website.csproj src/SOR.Website/
COPY src/SOR.Database/SOR.Database.csproj src/SOR.Database/
COPY src/SOR.Shared/SOR.Shared.csproj src/SOR.Shared/
COPY src/SOR.Networking.Abstractions/SOR.Networking.Abstractions.csproj src/SOR.Networking.Abstractions/
RUN dotnet restore src/SOR.Website/SOR.Website.csproj
# Copy full source (needed for migrations embedded in SOR.Database and wwwroot assets).
COPY . .
RUN dotnet publish src/SOR.Website/SOR.Website.csproj \
-c Release \
--no-restore \
-o /app/publish
# ── Stage 2: Runtime ──────────────────────────────────────────────────────────
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS runtime
WORKDIR /app
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.Website.dll"]