ASP.NET Core 10 API and React client that visualize the canton of Thurgau's hourly traffic counts by vehicle class (data.tg.ch, CC0). - Background refresh from data.tg.ch every 6 h into a per-day JSON cache, so history grows beyond the source's two-week window - Road geometry per station direction from swisstopo swissTLM3D, oriented by geocoding the direction's target town; roundabout arms follow the road outward only - Leaflet map with canvas animation: dots drive along the road in both directions, density by hourly count, colour by vehicle class, right-hand traffic; play/pause, time slider and day selection - Station panel with per-class counts and Chart.js charts (hourly, weekday/weekend profile, daily totals, class mix) - swisstopo base map switcher (grey, colour, aerial) - Dockerfile and docker-compose with a data volume - xUnit tests for mapping, cache, geometry, geocoding and analysis Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
31 lines
1.3 KiB
Docker
31 lines
1.3 KiB
Docker
# ---- Stage 1: build the React client into Schaad.OpenData.Server/wwwroot ----
|
|
FROM node:20-bookworm-slim AS build-client
|
|
WORKDIR /src/client
|
|
COPY client/package.json client/package-lock.json ./
|
|
RUN npm ci
|
|
COPY client/ ./
|
|
RUN npm run build
|
|
|
|
# ---- Stage 2: publish the ASP.NET Core server ----
|
|
FROM mcr.microsoft.com/dotnet/sdk:10.0 AS build-server
|
|
WORKDIR /src
|
|
COPY Directory.Build.props Directory.Packages.props ./
|
|
COPY Schaad.OpenData.Server/Schaad.OpenData.Server.csproj Schaad.OpenData.Server/
|
|
COPY Schaad.OpenData.Traffic/Schaad.OpenData.Traffic.csproj Schaad.OpenData.Traffic/
|
|
RUN dotnet restore Schaad.OpenData.Server/Schaad.OpenData.Server.csproj
|
|
COPY Schaad.OpenData.Server/ Schaad.OpenData.Server/
|
|
COPY Schaad.OpenData.Traffic/ Schaad.OpenData.Traffic/
|
|
COPY --from=build-client /src/Schaad.OpenData.Server/wwwroot Schaad.OpenData.Server/wwwroot
|
|
RUN dotnet publish Schaad.OpenData.Server/Schaad.OpenData.Server.csproj -c Release -o /app --no-restore
|
|
|
|
# ---- Stage 3: runtime ----
|
|
FROM mcr.microsoft.com/dotnet/aspnet:10.0 AS runtime
|
|
WORKDIR /app
|
|
COPY --from=build-server /app .
|
|
RUN mkdir -p /app/data && chown $APP_UID /app/data
|
|
USER $APP_UID
|
|
ENV ASPNETCORE_HTTP_PORTS=8080 \
|
|
Traffic__DataPath=/app/data
|
|
VOLUME /app/data
|
|
EXPOSE 8080
|
|
ENTRYPOINT ["dotnet", "Schaad.OpenData.Server.dll"]
|