mirror of
https://github.com/alexhopeoconnor/bom-local-service.git
synced 2026-10-03 21:21:59 +10:00
Major architectural changes: - Replace monolithic ScrapingService with workflow-based system - Extract scraping logic into discrete, testable steps - Add configuration-driven selectors, JavaScript templates, and text patterns - Implement step registry and workflow factory for extensibility - Add PageState tracking and step dependencies - Make IWorkflow generic to support different response types New components: - Scraping steps organized by category (Navigation, Search, Map, Metadata, Capture) - BaseScrapingStep base class with common dependencies - ScrapingContext for shared state between steps - RadarScrapingWorkflow orchestrating step execution - SelectorService for configurable element selection - Configuration models (SelectorConfig, TextPatternsConfig, JavaScriptTemplatesConfig) Performance and monitoring: - Add step-level timing metrics with historical tracking - Log step durations and compare to averages - Warn on slow steps/workflows (50%+ slower than average) - Integrate metrics with CacheService Configuration improvements: - Externalize all selectors to appsettings.json - Externalize JavaScript templates to appsettings.json - Externalize text patterns to appsettings.json - Support Docker configuration via mounted appsettings.json - Remove hardcoded waits, use configurable timeouts Bug fixes: - Fix DebugService collection modification exception - Fix ResetToFirstFrameStep click interception with JavaScript fallback - Remove minutes ago fallback, use timestamp parsing only - Update timestamp parsing for new BOM website format Documentation: - Update README with new architecture details - Add configuration section with Docker guidance - Add development guidelines for extending scraping system - Add performance monitoring documentation
52 lines
1.8 KiB
Docker
52 lines
1.8 KiB
Docker
# Build stage
|
|
FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build
|
|
WORKDIR /src
|
|
|
|
# Copy csproj and restore dependencies
|
|
COPY ["BomLocalService.csproj", "./"]
|
|
RUN dotnet restore "BomLocalService.csproj"
|
|
|
|
# Copy everything else and build
|
|
COPY . .
|
|
RUN dotnet build "BomLocalService.csproj" -c Release -o /app/build
|
|
|
|
# Publish stage
|
|
FROM build AS publish
|
|
RUN dotnet publish "BomLocalService.csproj" -c Release -o /app/publish /p:UseAppHost=false
|
|
|
|
# Runtime stage - use official Playwright .NET image that has browsers and dependencies pre-installed
|
|
FROM mcr.microsoft.com/playwright/dotnet:v1.57.0-noble AS final
|
|
WORKDIR /app
|
|
|
|
# Install .NET 9 runtime and Xvfb for virtual display (Playwright image has browsers but may need .NET 9)
|
|
RUN apt-get update && \
|
|
wget https://dot.net/v1/dotnet-install.sh -O dotnet-install.sh && \
|
|
chmod +x dotnet-install.sh && \
|
|
./dotnet-install.sh --channel 9.0 --install-dir /usr/share/dotnet && \
|
|
rm dotnet-install.sh && \
|
|
apt-get install -y xvfb x11vnc fluxbox curl && \
|
|
apt-get clean && \
|
|
rm -rf /var/lib/apt/lists/*
|
|
|
|
# Copy published app
|
|
COPY --from=publish /app/publish .
|
|
|
|
# Create cache directory for screenshots
|
|
RUN mkdir -p /app/cache && chmod 777 /app/cache
|
|
|
|
# Copy startup script
|
|
COPY scripts/docker-start.sh /app/start.sh
|
|
RUN chmod +x /app/start.sh
|
|
|
|
# OCI labels for GitHub Container Registry metadata
|
|
LABEL org.opencontainers.image.source="https://github.com/alexhopeoconnor/bom-local-service"
|
|
LABEL org.opencontainers.image.description="BOM Local Service - Australian Bureau of Meteorology radar data caching service for Home Assistant and local services"
|
|
LABEL org.opencontainers.image.licenses=MIT
|
|
|
|
EXPOSE 8080
|
|
|
|
HEALTHCHECK --interval=30s --timeout=10s --start-period=40s --retries=3 \
|
|
CMD curl --fail http://localhost:8080/api/health || exit 1
|
|
|
|
ENTRYPOINT ["/app/start.sh"]
|