# Stage 1: Build frontend FROM node:22-bookworm-slim AS frontend WORKDIR /app/frontend ARG FRONTEND_BUGSINK_DSN= ARG BUGSINK_ENVIRONMENT=production ARG BUGSINK_RELEASE= ARG BUGSINK_SEND_DEFAULT_PII=true ENV FRONTEND_BUGSINK_DSN=$FRONTEND_BUGSINK_DSN ENV BUGSINK_ENVIRONMENT=$BUGSINK_ENVIRONMENT ENV BUGSINK_RELEASE=$BUGSINK_RELEASE ENV BUGSINK_SEND_DEFAULT_PII=$BUGSINK_SEND_DEFAULT_PII COPY frontend/package.json frontend/package-lock.json ./ RUN npm ci RUN apt-get update \ && npx puppeteer browsers install chrome --install-deps \ && rm -rf /var/lib/apt/lists/* COPY frontend/ ./ RUN npm run build # Stage 2: Build Rust server FROM rust:1.84-bookworm AS server WORKDIR /app COPY server-rs/ server-rs/ WORKDIR /app/server-rs RUN cargo build --release # Stage 3: Runtime FROM debian:bookworm-slim RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates curl && rm -rf /var/lib/apt/lists/* RUN groupadd -r appuser && useradd -r -g appuser -d /app appuser WORKDIR /app COPY --from=server /app/server-rs/target/release/property-map-server ./ COPY --from=frontend /app/frontend/dist ./frontend/dist/ VOLUME ["/app/data"] RUN chown -R appuser:appuser /app USER appuser EXPOSE 8001 HEALTHCHECK --interval=30s --timeout=5s --start-period=120s --retries=3 \ CMD curl -f http://localhost:8001/health || exit 1 ENTRYPOINT ["./property-map-server"] CMD ["--properties", "/app/data/properties.parquet", "--postcode-features", "/app/data/postcode.parquet", "--pois", "/app/data/filtered_uk_pois.parquet", "--places", "/app/data/places.parquet", "--tiles", "/app/data/uk.pmtiles", "--postcodes", "/app/data/postcode_boundaries", "--travel-times", "/app/data/travel-times", "--dist", "/app/frontend/dist"]