OpenDataVisualizer/Dockerfile
Claudio Schaad 7b65926aa2 Add Thurgau traffic visualizer and start page (#1)
- Thurgau hourly traffic counts (data.tg.ch) refreshed every 6 h into a per-day JSON cache
- Road geometry per station direction from swisstopo swissTLM3D; roundabout arms run outward from the roundabout centre
- Leaflet map with animated vehicles by class, time controls and base map switcher (grey, colour, aerial)
- Station panel with per-class counts and Chart.js charts
- Start page with map tiles; traffic map at /verkehr/thurgau
- Dockerfile and docker-compose, xUnit tests

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Claudio Schaad <c.schaad@pog.ch>
Co-committed-by: Claudio Schaad <c.schaad@pog.ch>
2026-11-06 20:17:26 +00:00

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"]