diff --git a/Server/Dockerfile.website b/Server/Dockerfile.website new file mode 100644 index 0000000..ac64b0d --- /dev/null +++ b/Server/Dockerfile.website @@ -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"]