@@ -9,23 +9,23 @@ FROM --platform=$TARGETPLATFORM ${RUNNER_IMAGE} AS runner
99# ---------- .NET SDK base (Debian/glibc) ----------
1010FROM --platform=$TARGETPLATFORM mcr.microsoft.com/dotnet/sdk:${DOTNET_TAG}
1111
12- # We intentionally do NOT set NUGET_PACKAGES or HOME here.
13- #
14- # At runtime the runner-zig sandbox force-sets HOME=/sandbox and mounts a
15- # fresh tmpfs over /tmp per request. Anything we stash under /tmp (e.g. a
16- # pre-restored package cache) is therefore invisible to user code, which is
17- # exactly what produced the previous "NU1301: Unable to load the service
18- # index for source https://api.nuget.org/v3/index.json" error.
19- #
20- # Instead we pre-restore into ./.nuget/packages under the workdir. The
21- # runner's per-request copyWorkspace step then carries the cache into
22- # /sandbox/.nuget/packages, where dotnet finds it via the default
23- # $HOME/.nuget/packages lookup — no network needed at request time.
24- #
25- # RUN_ENV_ALLOW makes the runner forward the listed DOTNET_* vars into the
26- # sandbox env. Without DOTNET_SKIP_FIRST_TIME_EXPERIENCE at runtime, dotnet
27- # prints the "Welcome to .NET" banner and tries to install the HTTPS dev
28- # cert on every /run.
12+ # We intentionally do NOT set NUGET_PACKAGES or HOME here.
13+ #
14+ # At runtime the runner-zig sandbox force-sets HOME=/sandbox and mounts a
15+ # fresh tmpfs over /tmp per request. Anything stashed under /tmp (e.g. a
16+ # pre-restored package cache) is therefore invisible to user code, which is
17+ # what produced the previous "NU1301: Unable to load the service index for
18+ # source https://api.nuget.org/v3/index.json" error.
19+ #
20+ # Instead we pre-restore into ./.nuget/packages under the workdir. The
21+ # runner's per-request copyWorkspace step then carries the cache into
22+ # /sandbox/.nuget/packages, where dotnet finds it via the default
23+ # $HOME/.nuget/packages lookup — no network needed at request time.
24+ #
25+ # RUN_ENV_ALLOW makes the runner forward the listed DOTNET_* vars into the
26+ # sandbox env. Without DOTNET_SKIP_FIRST_TIME_EXPERIENCE at runtime, dotnet
27+ # prints the "Welcome to .NET" banner and tries to install the HTTPS dev
28+ # cert on every /run.
2929ENV DOTNET_NOLOGO=1 \
3030 DOTNET_CLI_TELEMETRY_OPTOUT=1 \
3131 DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1 \
@@ -34,42 +34,44 @@ ENV DOTNET_NOLOGO=1 \
3434
3535WORKDIR /usr/src/app
3636
37- # System deps
37+ # System deps
3838RUN apt-get update \
3939 && apt-get install -y --no-install-recommends make curl ca-certificates \
4040 && rm -rf /var/lib/apt/lists/*
4141
42- # Create non-root user + writable workdir. The runner-zig sandbox runs user
43- # code as RUN_UID_BASE+slot (default 10001+slot); matching that here keeps
44- # build-time and runtime UIDs aligned.
42+ # Create non-root user + writable workdir. UID matches RUN_UID_BASE+slot
43+ # (default 10001+slot) so build-time and runtime ownership line up.
4544RUN groupadd -g 10001 -r runneruser \
4645 && useradd -r -g runneruser -u 10001 -m -d /home/runneruser -s /usr/sbin/nologin runneruser \
4746 && chown -R runneruser:runneruser /home/runneruser /usr/src/app
4847
4948USER runneruser
5049
51- # Keep obj/bin project-local so they live inside /sandbox at runtime. The
52- # runner's recursive chown gives the slot UID write access to every
53- # workspace sub-path, so dotnet build can scribble into ./obj freely.
50+ # Keep obj/bin project-local so they live inside /sandbox at runtime. The
51+ # runner's umask=0 + 0o700 slot-owned top-level dir give the slot UID write
52+ # access to every workspace sub-path, so dotnet build can scribble into
53+ # ./obj freely. NuGetAudit=false silences NU1900 warnings — the audit
54+ # endpoint can't be reached from the netns-isolated sandbox.
5455RUN cat > Directory.Build.props <<'EOF'
55- <Project>
56- <PropertyGroup>
57- <BaseIntermediateOutputPath>obj/</BaseIntermediateOutputPath>
58- <IntermediateOutputPath>obj/</IntermediateOutputPath>
59- <BaseOutputPath>bin/</BaseOutputPath>
60- </PropertyGroup>
61- </Project>
56+ <Project>
57+ <PropertyGroup>
58+ <BaseIntermediateOutputPath>obj/</BaseIntermediateOutputPath>
59+ <IntermediateOutputPath>obj/</IntermediateOutputPath>
60+ <BaseOutputPath>bin/</BaseOutputPath>
61+ <NuGetAudit>false</NuGetAudit>
62+ </PropertyGroup>
63+ </Project>
6264EOF
6365
64- # Restore into the workdir (--packages) so the cache survives the runtime
65- # workspace copy. Layer order: csproj first for better Docker cache reuse
66- # when only source files change.
66+ # Restore into the workdir (--packages) so the cache survives the runtime
67+ # workspace copy. Layer order: csproj first for better Docker cache reuse
68+ # when only source files change.
6769COPY --chown=runneruser:runneruser Checker.csproj ./
6870RUN dotnet restore --disable-parallel \
69- --packages /usr/src/app/.nuget/packages \
70- --source https://api.nuget.org/v3/index.json
71+ --packages /usr/src/app/.nuget/packages \
72+ --source https://api.nuget.org/v3/index.json
7173
72- # App sources
74+ # App sources
7375COPY --chown=runneruser:runneruser Program.cs .
7476COPY --chown=runneruser:runneruser check ./check
7577COPY --chown=runneruser:runneruser Makefile .
0 commit comments