Files

30 lines
1.3 KiB
Docker

# syntax=docker/dockerfile:1
# --- Build stage: the SDK image compiles and publishes the app ---
FROM mcr.microsoft.com/dotnet/sdk:10.0 AS build
WORKDIR /src
# Copy the solution-wide build files first (Central Package Management lives in
# Directory.Packages.props; without it a restore fails with NU1015). Then the
# csproj of every project in the web app's dependency tree. Restoring before
# copying the rest of the source keeps the NuGet layer cached as long as the
# dependencies do not change.
COPY Directory.Build.props Directory.Packages.props ./
COPY Elternbeirat.Web/Elternbeirat.Web.csproj Elternbeirat.Web/
COPY Elternbeirat.PocketBase/Elternbeirat.PocketBase.csproj Elternbeirat.PocketBase/
COPY Elternbeirat.Contracts/Elternbeirat.Contracts.csproj Elternbeirat.Contracts/
RUN dotnet restore Elternbeirat.Web/Elternbeirat.Web.csproj
# Then the rest of the source.
COPY . .
RUN dotnet publish Elternbeirat.Web/Elternbeirat.Web.csproj -c Release -o /app
# --- Runtime stage: slim chiseled image, runs as non-root (UID 1654), listens
# on port 8080, has no shell (no HEALTHCHECK with curl/sh). The "extra" variant
# carries ICU and tzdata, which the pages need to format German (de-DE) dates. ---
FROM mcr.microsoft.com/dotnet/aspnet:10.0-noble-chiseled-extra AS runtime
WORKDIR /app
COPY --from=build /app .
EXPOSE 8080
ENTRYPOINT ["dotnet", "Elternbeirat.Web.dll"]