Model/.devcontainer/backend/Dockerfile
Jun-te Kim 4d14607e7e Add SAP-16.2 schema coverage + single-glazing fix; flat party-wall fix; pin 2 certs
SAP-Schema-16.2 (datatypes/epc/domain/mapper.py):
- 16.2 is structurally an RdSAP-17.1 cert under a different name; add
  _normalize_sap_schema_16_2 (field renames + defaults) and dispatch to the
  tested from_rdsap_schema_17_1 mapper. uprn_100020933699 maps → SAP 71.
- Honour a "Single glazed" windows description when multiple_glazing_type="ND"
  (was defaulting to double) → RdSAP-21 code 5; eng 72→71 (lodged 70).
- 4 regression tests + sap_16_2.json fixture; 0 new pyright errors.

Flat party-wall fix (domain/sap10_calculator/worksheet/heat_transmission.py):
- Full-SAP flats carry flatness in dwelling_type, not property_type, so the
  party-wall default fell through to the 0.25 house value instead of the RdSAP
  Table-15 flat 0.0. Add _is_flat_or_maisonette_dwelling fallback + regression
  test. uprn_10093116529 80→81 (matches the cert's lodged party u_value 0).

Accuracy corpus pins (tests/domain/sap10_calculator/test_real_cert_sap_accuracy.py):
- uprn_10093116543 (SAP-17.1 gas-combi semi): engine 81 (Elmhurst 77; documented
  full-SAP→RdSAP residual — measured wall/floor U + PCDB boiler vs RdSAP defaults).
- uprn_10093116529 (SAP-17.1 g/f flat): engine 81 (Elmhurst 78).

devcontainer: add poppler-utils (pdfinfo) for the documents-parser PDF fixtures.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-16 18:53:00 +00:00

115 lines
4.9 KiB
Docker

FROM python:3.11.10-bookworm
ARG USER=vscode
ARG USER_UID=1000
ARG USER_GID=1000
ARG DEBIAN_FRONTEND=noninteractive
# 1) Toolchain + utilities for building libpostal, plus LazyVim deps.
# poppler-utils provides `pdfinfo`, required by backend/documents_parser (the
# Elmhurst Input-Summary / SAP-worksheet PDF fixtures in the SAP corpus tests
# shell out to it).
RUN apt-get update && apt-get install -y --no-install-recommends \
sudo jq vim curl git ca-certificates wget \
build-essential pkg-config automake autoconf libtool \
ripgrep fd-find make unzip bash-completion poppler-utils \
&& rm -rf /var/lib/apt/lists/*
# 1b) Headed-browser viewer stack for the hyde Elmhurst automation.
# scripts/hyde/start_viewer.sh chains these: Xvfb (virtual :99 screen) ->
# fluxbox (window manager) -> x11vnc (VNC on 5900) -> novnc/websockify
# (browser-accessible desktop on 6080). Lets a human watch/click the headed
# Playwright browser while building certs in Elmhurst.
RUN apt-get update && apt-get install -y --no-install-recommends \
xvfb fluxbox x11vnc novnc websockify \
&& rm -rf /var/lib/apt/lists/*
# Neovim latest (LazyVim needs >=0.9)
RUN curl -fsSL https://github.com/neovim/neovim/releases/latest/download/nvim-linux-x86_64.tar.gz \
| tar -xz -C /opt \
&& ln -s /opt/nvim-linux-x86_64/bin/nvim /usr/local/bin/nvim
# 3) Create the user and grant sudo privileges
RUN groupadd -g ${USER_GID} ${USER} \
&& useradd -m -u ${USER_UID} -g ${USER_GID} -s /usr/bin/bash ${USER} \
&& echo "${USER} ALL=(ALL) NOPASSWD: ALL" >/etc/sudoers.d/${USER} \
&& chmod 0440 /etc/sudoers.d/${USER}
#
ENV PIP_NO_CACHE_DIR=1 PIP_DISABLE_PIP_VERSION_CHECK=1
ADD backend/engine/requirements.txt requirements1.txt
ADD backend/app/requirements/requirements.txt requirements2.txt
ADD .devcontainer/backend/requirements.txt requirements3.txt
ADD etl/hubspot/requirements.txt requirements4.txt
RUN cat requirements1.txt requirements2.txt requirements3.txt requirements4.txt > requirements.txt
RUN pip install -r requirements.txt
# Playwright OS dependencies for the hyde Elmhurst automation (scripts/hyde/).
# The pip `playwright` package is in requirements above; this pulls the apt
# libraries chromium needs. The browser BINARY itself is downloaded as the
# vscode user further down (its cache lives in /home/vscode/.cache/ms-playwright,
# which is where the automation runs from).
RUN python -m playwright install-deps chromium
# 5) Workdir
WORKDIR /workspaces/model
# 6) Make Python find your package
# Add project root to PYTHONPATH for all processes
ENV PYTHONPATH=/workspaces/model:${PYTHONPATH}
# Install terraform
RUN apt-get update && sudo apt-get install -y gnupg software-properties-common
RUN wget -O- https://apt.releases.hashicorp.com/gpg | \
gpg --dearmor | \
sudo tee /usr/share/keyrings/hashicorp-archive-keyring.gpg > /dev/null
RUN echo "deb [signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] \
https://apt.releases.hashicorp.com $(lsb_release -cs) main" | \
tee /etc/apt/sources.list.d/hashicorp.list
RUN apt update
RUN apt-get install -y terraform
RUN terraform -install-autocomplete || true
# Install postgres
RUN apt install -y wget gnupg2 lsb-release
RUN echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" | sudo tee /etc/apt/sources.list.d/pgdg.list
RUN wget -qO - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
RUN apt update
RUN apt install -y postgresql-14
# Install Node.js
RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \
&& apt-get install -y nodejs \
&& rm -rf /var/lib/apt/lists/*
# GitHub CLI — used by the postCreate skill installer to authenticate against
# private Hestia-Homes repos via the host's mounted ~/.config/gh.
RUN curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg \
| dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg \
&& chmod go+r /usr/share/keyrings/githubcli-archive-keyring.gpg \
&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" \
> /etc/apt/sources.list.d/github-cli.list \
&& apt update && apt install -y gh \
&& rm -rf /var/lib/apt/lists/*
USER ${USER}
# Bootstrap LazyVim starter config
RUN git clone https://github.com/LazyVim/starter /home/${USER}/.config/nvim \
&& rm -rf /home/${USER}/.config/nvim/.git
# Install Claude Code CLI (skills are installed via postCreate from Hestia-Homes/agentic-toolkit)
RUN curl -fsSL https://claude.ai/install.sh | bash
ENV PATH="/home/vscode/.local/bin:${PATH}"
# Playwright chromium browser for the hyde Elmhurst automation. Run as the
# vscode user so the download lands in /home/vscode/.cache/ms-playwright (the
# OS deps were installed as root above). Headed chromium is required — the
# automation launches with headless=False onto the noVNC desktop (:99).
RUN python -m playwright install chromium
USER root