# SPDX-FileCopyrightText: 2026 Science Against Authoritarianism Contributors
# SPDX-License-Identifier: GPL-3.0-or-later
#
# Reproducible environment for the Pharos quantitative pillar. The project is
# stdlib-only, so there is nothing to pip-install — the image just pins Python and
# runs the deterministic, network-free gate. Same result on a laptop, in CI, or on
# any rented box:
#
#   docker build -t pharos . && docker run --rm pharos        # -> verify-offline
#   docker run --rm pharos make dashboard                     # -> GREEN/RED report
#
# Pinned to the python:3.12-slim OCI index digest (multi-arch manifest) as of 2026-06-24.
FROM python:3.12-slim@sha256:6c4dd321d176d61ea848dc8c73a4f7dbae8f70e0ee48bb411ea2f045b599fa8e

WORKDIR /pharos

# `make` runs the gate targets; `nodejs` runs the offline native Node frontend tests
# inside `make verify-offline`. `git` is optional (warns and continues when .git is absent).
RUN apt-get update \
    && apt-get install -y --no-install-recommends make nodejs \
    && rm -rf /var/lib/apt/lists/*

# Run as an unprivileged user; the repo is read-only during verification.
RUN useradd -m -u 1000 pharos
COPY --chown=pharos:pharos . .
USER pharos

# Default: the deterministic gate — recompute indicators from the committed
# snapshots (no network), check for drift, run the tests + ledger + honesty audits.
CMD ["make", "verify-offline"]
