Files
aevolution/deploy/docker/Dockerfile
T
dingoandClaude Opus 5.5 7aec68db8e Complete M7.8 operations endpoints and region server image
ADR-0066: evo-server --ops-listen serves /livez (loop responding, never
authority), /readyz (200 only while the host holds the lease with a
verified recovered head) and /metrics (Prometheus text: 30 fixed
series for readiness, phase, lease epoch/remaining, simulated/committed
ticks, commit lag, checkpoint age, tick debt, queue use and bounds, and
counters; the only labels are a 6-value phase and 4-value drop reason).

The dependency-free OpsServer runs on the host loop with no thread:
GET on exact paths, 405/404/400/431 responses, 8 connections with excess
refused on accept, 4 KiB requests, 1 s deadlines, 16 KiB responses.
HostStatus/phase types moved to the portable evo::ops library with a
Windows-tested renderer. evo-server now refuses to start without its
required identity and connection settings.

Adds the server-runtime Docker target (evo-server + pinned libpq,
UID 10001, no credentials), a CI server-image job with smoke script and
optional publishing, and a Kubernetes example outside Argo.

Validated: Windows CTest 59/59; Linux Debug/Release/clang-tidy/ASan
CTest 59/59; PostgreSQL suites under Release, clang-tidy and ASan with
real process probes; two ops mutations caught. Docker build/smoke and
Gitea CI not executed locally.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 23:09:28 -04:00

119 lines
6.2 KiB
Docker

# Development bootstrap tag. Promotion requires an approved immutable digest.
ARG UBUNTU_IMAGE=ubuntu:24.04
FROM ${UBUNTU_IMAGE} AS toolchain
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update \
&& apt-get install -y --no-install-recommends ca-certificates cmake ninja-build g++-14 \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /source
COPY CMakeLists.txt CMakePresets.json .clang-format .clang-tidy ./
COPY cmake/ cmake/
COPY include/ include/
COPY src/ src/
COPY apps/ apps/
COPY tests/ tests/
COPY experiments/ experiments/
COPY tools/ tools/
FROM toolchain AS ci-toolchain
RUN apt-get update \
&& apt-get install -y --no-install-recommends clang-19 clang-format-19 \
clang-tidy-19 libclang-rt-19-dev \
&& rm -rf /var/lib/apt/lists/*
RUN dpkg-query -W
FROM ci-toolchain AS ci-checks
RUN bash tools/ci/linux-check.sh checks
FROM ci-toolchain AS ci-tsan
RUN cmake --preset tsan -DCMAKE_CXX_COMPILER=clang++-19 \
&& cmake --build --preset tsan --parallel 2
CMD ["ctest", "--preset", "tsan", "--no-tests=error", "--timeout", "120"]
FROM ci-toolchain AS ci-ecs
# Explicit experiment preparation; normal configure/runtime remains dependency-free.
RUN cmake -P tools/prepare-entt.cmake \
&& cmake --preset release -B build/ecs -DCMAKE_CXX_COMPILER=g++-14 -DEVO_BUILD_ECS_EXPERIMENT=ON \
&& cmake --build build/ecs --target evo-ecs-experiment --parallel 2 \
&& ctest --test-dir build/ecs -R ecs-experiment --output-on-failure --no-tests=error \
&& ./build/ecs/evo-ecs-experiment --measure \
&& stat -c 'experiment_executable_bytes=%s' build/ecs/evo-ecs-experiment
RUN cmake --preset asan -B build/ecs-asan -DCMAKE_CXX_COMPILER=clang++-19 -DEVO_BUILD_ECS_EXPERIMENT=ON \
&& cmake --build build/ecs-asan --target evo-ecs-experiment --parallel 2 \
&& ctest --test-dir build/ecs-asan -R ecs-experiment --output-on-failure --no-tests=error
RUN cmake --preset analysis -B build/ecs-analysis -DCMAKE_CXX_COMPILER=clang++-19 -DEVO_BUILD_ECS_EXPERIMENT=ON \
&& cmake --build build/ecs-analysis --target evo-ecs-experiment --parallel 2 \
&& ctest --test-dir build/ecs-analysis -R ecs-experiment --output-on-failure --no-tests=error
FROM ci-toolchain AS postgres-build
RUN apt-get update && apt-get install -y --no-install-recommends \
curl bzip2 make flex bison perl libssl-dev zlib1g-dev pkg-config \
&& rm -rf /var/lib/apt/lists/*
COPY migrations/ migrations/
# The toolchain installs versioned compilers only; there is no bare cc/gcc.
RUN CC=gcc-14 bash tools/prepare-postgres.sh
RUN cmake --preset release -B build/postgres -DCMAKE_CXX_COMPILER=g++-14 \
-DEVO_BUILD_POSTGRES=ON -DPostgreSQL_ROOT=/source/.cache/postgres/install \
&& cmake --build build/postgres --target evo-postgres-tests --parallel 2
RUN cmake --preset analysis -B build/postgres-analysis -DCMAKE_CXX_COMPILER=clang++-19 \
-DEVO_BUILD_POSTGRES=ON -DPostgreSQL_ROOT=/source/.cache/postgres/install \
&& cmake --build build/postgres-analysis --target evo-postgres-tests --parallel 2
RUN cmake --preset asan -B build/postgres-asan -DCMAKE_CXX_COMPILER=clang++-19 \
-DEVO_BUILD_POSTGRES=ON -DPostgreSQL_ROOT=/source/.cache/postgres/install \
&& cmake --build build/postgres-asan --target evo-postgres-tests --parallel 2
FROM postgres-build AS ci-postgres
RUN useradd --uid 10001 --no-create-home evo
USER 10001:10001
RUN bash tools/ci/postgres-check.sh /source/build/postgres/evo-postgres-tests \
&& bash tools/ci/postgres-check.sh /source/build/postgres-analysis/evo-postgres-tests \
&& bash tools/ci/postgres-check.sh /source/build/postgres-asan/evo-postgres-tests
FROM ${UBUNTU_IMAGE} AS postgres-tools
RUN apt-get update && apt-get install -y --no-install-recommends libssl3t64 zlib1g ca-certificates \
&& rm -rf /var/lib/apt/lists/* \
&& groupadd --gid 10001 evo && useradd --uid 10001 --gid 10001 --no-create-home evo
COPY --from=postgres-build /source/.cache/postgres/install/bin/psql /opt/postgres/bin/psql
COPY --from=postgres-build /source/.cache/postgres/install/lib/libpq.so* /opt/postgres/lib/
COPY --from=postgres-build /source/.cache/postgres/postgresql-18.6/COPYRIGHT /usr/share/doc/evo-postgres/COPYRIGHT
COPY tools/migrate-postgres.sh /opt/evo/tools/migrate-postgres.sh
COPY migrations/ /opt/evo/migrations/
ENV PATH="/opt/postgres/bin:${PATH}" LD_LIBRARY_PATH=/opt/postgres/lib
USER 10001:10001
ENTRYPOINT ["bash", "/opt/evo/tools/migrate-postgres.sh"]
# M7.8 development region server image (ADR-0066): evo-server with the pinned
# libpq, non-root, no credentials. Connection secrets are mounted at runtime only.
FROM ${UBUNTU_IMAGE} AS server-runtime
RUN apt-get update && apt-get install -y --no-install-recommends libstdc++6 libgcc-s1 libssl3t64 zlib1g ca-certificates && rm -rf /var/lib/apt/lists/* && groupadd --gid 10001 evo && useradd --uid 10001 --gid 10001 --no-create-home --home-dir /nonexistent --shell /usr/sbin/nologin evo
COPY --from=postgres-build /source/build/postgres/evo-server /usr/local/bin/evo-server
COPY --from=postgres-build /source/.cache/postgres/install/lib/libpq.so* /opt/postgres/lib/
COPY --from=postgres-build /source/.cache/postgres/postgresql-18.6/COPYRIGHT /usr/share/doc/evo-postgres/COPYRIGHT
ENV LD_LIBRARY_PATH=/opt/postgres/lib
USER 10001:10001
WORKDIR /tmp
EXPOSE 9100
ENTRYPOINT ["/usr/local/bin/evo-server"]
FROM toolchain AS build
RUN cmake --preset release -B build/container \
-DCMAKE_CXX_COMPILER=g++-14 -DCMAKE_RUNTIME_OUTPUT_DIRECTORY=/opt/evo/bin \
&& cmake --build build/container --parallel 2 \
&& ctest --test-dir build/container --output-on-failure --no-tests=error --timeout 120
RUN dpkg-query -W > /opt/evo/build-packages.txt
FROM ${UBUNTU_IMAGE} AS runtime
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update \
&& apt-get install -y --no-install-recommends libstdc++6 libgcc-s1 \
&& rm -rf /var/lib/apt/lists/* \
&& groupadd --gid 10001 evo \
&& useradd --uid 10001 --gid 10001 --no-create-home \
--home-dir /nonexistent --shell /usr/sbin/nologin evo
COPY --from=build /opt/evo/bin/evo-sim /usr/local/bin/evo-sim
COPY --from=build /opt/evo/build-packages.txt /usr/share/evo/build-packages.txt
USER 10001:10001
WORKDIR /tmp
ENTRYPOINT ["/usr/local/bin/evo-sim"]
CMD ["--seed", "123456", "--ticks", "1000"]