Round 5's cold review found the class a fifth time, and it was a BLOCKER rather than a narrowing. The restatement inlined both documented components but computed its filename with `basename(path)` — the same helper `isInScopeSourcePath` calls — so `basename` sat on both sides of the comparison and cancelled, exactly as the filename predicate did in round 4 and the path table in round 3. MEASURED on the previous head: teaching `basename` to return '' for paths four segments deep removed 15 real tracked files, and a `pageSize: 100` planted in one of them (`src/builder/rules/compile.ts`) went completely unseen — 36/36 green. Reproduced here before fixing. The guard did not merely see less; it stopped working and reported success. An `index.ts` variant hid 3 more. What actually terminates this, and why the previous four attempts did not: each one restated something and left something else SHARED, and "restate the scope" gives no way to tell whether you are done. The criterion is now a checkable property, written where the next author will edit: the restatement must be CLOSED FORM over the raw path — it may share NO helper, at ANY depth, with `isInScopeSourcePath`. `basename` is why it is phrased that way: it reads as plumbing rather than as policy, which is precisely why it got shared. The inlined `lastIndexOf` carries a "do not tidy this into basename(path)" note for the same reason. Both mutations above now redden `the shared scope predicate is EXACTLY its two documented components`, including with the rogue site planted. The previous head also ASSERTED that its residuals were complete, which this blocker falsifies — a single-site edit to a shared helper narrowed scope invisibly. Both the code comment and `docs/guard-inventory.md` now record the three retracted mechanisms with what each one measured, and state the two residuals as residuals rather than as closure. Also from round 5: - The anti-vacuity floor fired at 15 unstaged in-scope deletions with a bare assertion message, inside a test whose own failure text tells the reader to rename files or widen the glob. Wrong cause, and the #806 shape. It now carries its own message naming deletions first and a degenerate plugin result second. - The Dockerfile's `docs_only` claim stated an accident as the rule. `ci-detect-docs-only.sh` classifies by PATH SHAPE (`docs/` or `*.md`), not by directory, so "any `web/**` path is not docs-only" is true only because no `web/*.md` is tracked. Restated, with `design-system/` named too. - `ABSENT_FROM_DISK` emptied is an uncaught mutation. Recorded as a residual with its DIRECTION, which is what makes it tolerable: an empty set makes the guard red on an unstaged deletion, never blind. - The decision record's `signals:` line carried neither the bounded exception's vocabulary nor #819, so the record's discovery surface did not carry the change its `rule:` makes. - A worked example still named `src/api/generated/v1.ts`; the tracked file is `v1.d.ts`. Swept both tables this time rather than the one site. Refs: #819 Decisions-Edit: yes
129 lines
7.1 KiB
Docker
129 lines
7.1 KiB
Docker
FROM mcr.microsoft.com/dotnet/aspnet:10.0-noble-amd64 AS dotnet-runtime
|
|
|
|
FROM node:22-bookworm-slim AS web-build
|
|
WORKDIR /source
|
|
COPY web/package*.json ./web/
|
|
WORKDIR /source/web
|
|
RUN npm ci
|
|
WORKDIR /source
|
|
COPY design-system/. ./design-system/
|
|
COPY web/. ./web/
|
|
WORKDIR /source/web
|
|
# No `npm test` here, deliberately (ersatztv#819). This stage's context is `web/` and
|
|
# `design-system/` only — no `.git`, and `node:22-bookworm-slim` ships no git binary — while the
|
|
# SPA's one population-deriving guard (`web/src/api/pageSizeCallSites.guard.test.ts`) takes its file
|
|
# population from `git ls-files` rather than a directory walk, and refuses rather than falling back,
|
|
# so the suite cannot run in a context with no index. It is not lost: `docker-build.yml`'s
|
|
# `Build & test (.NET)` job runs the identical `npm test -- --run` on a real checkout, and `build`
|
|
# (the job that invokes this Dockerfile) carries `needs: [test, migrations, scan]`. State the chain
|
|
# precisely, because that `needs:` edge is not the whole of it: the `Test SPA` step is gated on
|
|
# `docs_only != 'true' && revalidate.skip != 'true'`, and `build` is NOT gated on `revalidate`. So
|
|
# on a push to `main` whose tree is byte-identical to an already-green head, the suite is skipped
|
|
# and the image still builds — the property holds there via #420's byte-identical-tree argument,
|
|
# not via the dependency edge. The `docs_only` arm holds by a different argument again:
|
|
# `scripts/ci-detect-docs-only.sh` treats a path as docs only when it is under `docs/` or ends
|
|
# `.md`, so any change to a `.ts`/`.tsx`/`.css` file under `web/` (or to `design-system/`, also in
|
|
# this stage's context) defeats the skip. A tree that takes it therefore has a build input subtree
|
|
# identical to one already tested. Note the rule is by PATH SHAPE, not by directory: a `web/*.md`
|
|
# would count as docs — there are none today, but do not restate this as "any `web/**` path". Either way the suite ran against that tree; running it a second time
|
|
# here only duplicated the work. Building the image by hand still lints, typechecks and builds; run
|
|
# `npm test` in a checkout for the rest.
|
|
RUN npm run lint && npm run typecheck && npm run build
|
|
|
|
FROM --platform=linux/amd64 192.168.1.95:3000/timothy/ersatztv-ffmpeg:8.1.2 AS runtime-base
|
|
COPY --from=dotnet-runtime /usr/share/dotnet /usr/share/dotnet
|
|
RUN apt-get update && \
|
|
apt-get install -y --no-install-recommends python3 python3-pip && \
|
|
python3 -m pip install --target=/app/pythonlibs --no-cache-dir streamlink && \
|
|
apt-get clean -y && \
|
|
rm -rf /var/lib/apt/lists/*
|
|
|
|
# https://hub.docker.com/_/microsoft-dotnet
|
|
FROM mcr.microsoft.com/dotnet/sdk:10.0-noble-amd64 AS build
|
|
RUN apt-get update && apt-get install -y ca-certificates gnupg default-jre-headless python3-pip
|
|
WORKDIR /source
|
|
|
|
# download the openapi-generator jar first so this layer is cached independently
|
|
# of the openapi spec dir below -- otherwise every spec change (e.g. v1.json)
|
|
# busts the layer and re-downloads the ~30MB jar (ersatztv#190)
|
|
RUN wget https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/7.15.0/openapi-generator-cli-7.15.0.jar
|
|
|
|
# generate openapi client
|
|
COPY ErsatzTV/wwwroot/openapi/. /app/ErsatzTV/wwwroot/openapi/
|
|
RUN java -jar openapi-generator-cli-7.15.0.jar generate -i /app/ErsatzTV/wwwroot/openapi/scripted-schedule.json -g python -o /app/etv-client --package-name etv_client
|
|
RUN rm -rf openapi-generator-cli-7.15.0.jar /app/ErsatzTV
|
|
RUN python3 -m pip install --target=/app/pythonlibs /app/etv-client
|
|
RUN rm -rf /app/etv-client
|
|
COPY scripts/scripted-schedules/. /app/scripted-schedules/
|
|
|
|
# copy csproj and restore as distinct layers
|
|
COPY *.sln .
|
|
# repo-wide build config (MSBuild props/targets incl. NuGet-audit warning
|
|
# exemptions, SDK pin, analyzer severities, and the Central Package Management
|
|
# version manifest) must be present before restore so the image build matches
|
|
# local/CI builds. Directory.Packages.props is REQUIRED here: with CPM the csproj
|
|
# carry no versions, so restore fails without the central manifest.
|
|
COPY Directory.Build.props Directory.Build.targets Directory.Packages.props global.json .editorconfig ./
|
|
COPY eng/analyzers/sdk-all-suggestion.globalconfig ./eng/analyzers/
|
|
COPY artwork/* ./artwork/
|
|
COPY ErsatzTV/*.csproj ./ErsatzTV/
|
|
COPY ErsatzTV.Application/*.csproj ./ErsatzTV.Application/
|
|
COPY ErsatzTV.Core/*.csproj ./ErsatzTV.Core/
|
|
COPY ErsatzTV.Core.Nullable/*.csproj ./ErsatzTV.Core.Nullable/
|
|
COPY ErsatzTV.FFmpeg/*.csproj ./ErsatzTV.FFmpeg/
|
|
COPY ErsatzTV.Infrastructure/*.csproj ./ErsatzTV.Infrastructure/
|
|
COPY ErsatzTV.Infrastructure.Sqlite/*.csproj ./ErsatzTV.Infrastructure.Sqlite/
|
|
COPY ErsatzTV.Infrastructure.MySql/*.csproj ./ErsatzTV.Infrastructure.MySql/
|
|
COPY ErsatzTV.Scanner/*.csproj ./ErsatzTV.Scanner/
|
|
|
|
# Disable the persistent Roslyn/MSBuild compiler servers for the in-image build (ersatztv#406,
|
|
# server-management#604). The workflow sets these as env for the runner-side dotnet jobs, but this
|
|
# stage compiles inside `docker build`, so the workflow's env does NOT reach it — the restore and
|
|
# the two publishes below would otherwise spin up their own VBCSCompiler and hold its heap. This is
|
|
# the `build` job that server-management#570 measured pegging 5.999/6 GiB, so it is the one that
|
|
# most needs this.
|
|
#
|
|
# Placed here rather than at the top of the stage on purpose: an ENV invalidates every layer below
|
|
# it, and the wget of the ~30MB openapi-generator jar above is deliberately ordered early to stay
|
|
# cached (ersatztv#190). Nothing between that wget and this line compiles, so this is the earliest
|
|
# point where the ENV is free.
|
|
#
|
|
# Build-stage only: the final image is FROM runtime-base and only COPY --from=build /app (files,
|
|
# not ENV), so none of this lands in the shipped image or affects runtime.
|
|
ENV UseSharedCompilation=false \
|
|
DOTNET_CLI_USE_MSBUILD_SERVER=0 \
|
|
MSBUILDDISABLENODEREUSE=1
|
|
|
|
RUN dotnet restore -r linux-x64 ErsatzTV/ErsatzTV.csproj
|
|
|
|
# copy everything else and build app
|
|
COPY ErsatzTV/. ./ErsatzTV/
|
|
COPY --from=web-build /source/ErsatzTV/wwwroot/app/. ./ErsatzTV/wwwroot/app/
|
|
COPY ErsatzTV.Application/. ./ErsatzTV.Application/
|
|
COPY ErsatzTV.Core/. ./ErsatzTV.Core/
|
|
COPY ErsatzTV.Core.Nullable/. ./ErsatzTV.Core.Nullable/
|
|
COPY ErsatzTV.FFmpeg/. ./ErsatzTV.FFmpeg/
|
|
COPY ErsatzTV.Infrastructure/. ./ErsatzTV.Infrastructure/
|
|
COPY ErsatzTV.Infrastructure.Sqlite/. ./ErsatzTV.Infrastructure.Sqlite/
|
|
COPY ErsatzTV.Infrastructure.MySql/. ./ErsatzTV.Infrastructure.MySql/
|
|
COPY ErsatzTV.Scanner/. ./ErsatzTV.Scanner/
|
|
ARG INFO_VERSION="unknown"
|
|
ARG BUILD_CONFIG="release"
|
|
WORKDIR /source/ErsatzTV.Scanner
|
|
RUN dotnet publish ErsatzTV.Scanner.csproj -c ${BUILD_CONFIG} -o /app -r linux-x64 --self-contained false --no-restore /p:DebugType=Embedded /p:InformationalVersion=${INFO_VERSION}
|
|
WORKDIR /source/ErsatzTV
|
|
RUN sed -i '/Scanner/d' ErsatzTV.csproj
|
|
RUN dotnet publish ErsatzTV.csproj -c ${BUILD_CONFIG} -o /app -r linux-x64 --self-contained false --no-restore /p:DebugType=Embedded /p:InformationalVersion=${INFO_VERSION}
|
|
|
|
# final stage/image
|
|
FROM runtime-base
|
|
ENV FONTCONFIG_PATH=/etc/fonts
|
|
RUN fc-cache update
|
|
WORKDIR /app
|
|
COPY --from=build /app ./
|
|
ENV PYTHONPATH=/app/pythonlibs
|
|
ENV ETV_CONFIG_FOLDER=/config
|
|
ENV ETV_TRANSCODE_FOLDER=/transcode
|
|
ENV ETV_DISABLE_VULKAN=1
|
|
ENTRYPOINT ["./ErsatzTV"]
|