Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
68 changes: 16 additions & 52 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,46 +1,36 @@
# A Linux container carrying every toolchain this repo's dev loop needs: the
# pinned Rust toolchain, Node and python3, plus (until the C# is removed) the
# pinned .NET SDK with wasm-tools, PowerShell and Lua 5.2.
# pinned Rust toolchain, Node and python3.
# CLAUDE.md's "Devcontainer" section says what it covers and what still needs
# the host (benchmarks and the Factorio oracle capture).
# the host (the Factorio oracle capture).
#
# Pinned to the exact SDK in global.json, by digest. That is the whole point of
# the container: `rollForward: latestMajor` only rolls FORWARD, so a host whose
# package manager trails the pin cannot build at all - measured 2026-09-21, when
# global.json moved to 10.0.401 and Homebrew still shipped 10.0.400.
#
# WHEN global.json MOVES, THIS LINE MUST MOVE WITH IT, and nothing enforces that.
# The Devcontainer CI job builds this image and asserts `dotnet --version`
# resolves inside the repo, which is what turns a forgotten bump into a red
# check rather than a container that silently disagrees with the repo.
# Plain Ubuntu 24.04 (noble), pinned by digest so every rebuild starts from
# the same bytes. It was the .NET SDK image until the C# was removed; that
# image is itself noble, so the apt packages below did not change.
# Re-pin with:
# docker buildx imagetools inspect mcr.microsoft.com/dotnet/sdk:<version>
FROM mcr.microsoft.com/dotnet/sdk:10.0.402@sha256:0d99ebf1ccad15037b5c98c9fe8979d6b8dbac23812feae2277a0b277b5c5ffa
# docker buildx imagetools inspect ubuntu:24.04
FROM ubuntu:24.04@sha256:68ee22004a9109b44973313b02ff7b1de250f1de0f5ecb628d73f579aaff33ac

# The base image is Ubuntu 24.04 (noble) and already has a `ubuntu` user at uid
# 1000, so there is no user to create - only sudo to add, for the postCreate
# chown of the named volumes.
# The base image already has a `ubuntu` user at uid 1000, so there is no user
# to create - only sudo to add, for the postCreate chown of the named volumes.
#
# lua5.2 is the package CI installs, and on noble it is 5.2.4 - the exact
# version the README's Lua performance log was measured against, and what
# nickblah/lua:5.2-alpine provides in tools/check-lua.sh. It ships the binaries
# as `lua5.2` and `luac5.2`, which is what the transpile-lua CI job calls them;
# tools/check-lua.sh prefers them over Docker when they are on PATH.
# git is for vite.config.ts, which stamps the build with `git describe`.
#
# python3 is only for trim-factorio-oracle.py. The capture itself cannot run in
# here - it needs a real Factorio install - but the trim half is worth having.
# python3 is for trim-factorio-oracle.py, and for the Devcontainer CI job's
# toolchain check, which reads rust/rust-toolchain.toml with tomllib. The
# capture itself cannot run in here - it needs a real Factorio install - but
# the trim half is worth having.
#
# gcc and libc6-dev are for Rust: cargo links native code (build scripts, proc
# macros, the test binaries) with `cc`. Nothing in rust/Cargo.lock compiles C,
# so the rest of build-essential (g++, make) is not needed.
# so the rest of build-essential (g++, make) is not needed. The wasm32 build
# links with rust-lld, which ships with the toolchain.
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
ca-certificates \
curl \
gcc \
git \
libc6-dev \
lua5.2 \
python3 \
sudo \
xz-utils \
Expand Down Expand Up @@ -74,32 +64,6 @@ RUN set -eux; \
node --version; \
npm --version

# PowerShell, because src/lua/Invoke-LuaBuild.ps1 is the only way to regenerate
# src/lua and the transpile-lua CI job runs it with `pwsh -File`.
#
# Installed as a dotnet tool rather than from Microsoft's apt repo: the tool
# feed carries arm64 and amd64 under one command, so this stays one code path
# for both architectures. The script itself sets DOTNET_ROLL_FORWARD=Major so
# the net7.0 CSharp.lua launcher runs on this .NET 10 runtime - no .NET 7
# runtime is needed here, despite what the launcher's target framework implies.
ARG POWERSHELL_VERSION=7.6.5
ENV DOTNET_TOOL_PATH=/usr/local/dotnet-tools
ENV PATH=${DOTNET_TOOL_PATH}:${PATH}
RUN dotnet tool install PowerShell \
--version "${POWERSHELL_VERSION}" \
--tool-path "${DOTNET_TOOL_PATH}" \
&& pwsh --version

# Needed by BrowserWasm and BlazorWebApp, so a full-solution `dotnet build`
# works in here. Installed at image build so it is not a surprise later:
# docker-build.sh has to tell you to prepend `dotnet workload restore`, and the
# point of this image is that you do not have to.
RUN dotnet workload install wasm-tools --skip-sign-check \
&& dotnet workload list

ENV DOTNET_CLI_TELEMETRY_OPTOUT=1 \
DOTNET_NOLOGO=1

USER ubuntu

# Rust, for rust/ and for `npm run build-wasm` in src/vue, which builds the
Expand Down
39 changes: 8 additions & 31 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,25 +1,15 @@
// A Linux container for the whole dev loop: the Rust planner (cargo build and
// test in rust/, and the WASM build the site loads), the Vue front-end, and,
// until the C# is removed, dotnet build/test and the Lua transpile with its 5.2
// checks. CLAUDE.md's "Devcontainer" section says what it covers and what still
// needs the host - benchmarks and the Factorio oracle capture.
// test in rust/, and the WASM build the site loads) and the Vue front-end.
// CLAUDE.md's "Devcontainer" section says what it covers and what still needs
// the host - the Factorio oracle capture.
//
// The Dockerfile pins the SDK from global.json by digest. That is the reason
// this exists: `rollForward: latestMajor` only rolls forward, so a host whose
// package manager trails the pin cannot build the repo at all. It also carries
// the Rust toolchain rust/rust-toolchain.toml pins, already installed.
// The Dockerfile carries the Rust toolchain rust/rust-toolchain.toml pins,
// already installed, and an exact, checksummed Node.
{
"name": "FactorioTools",
"build": { "dockerfile": "Dockerfile" },
// uid 1000 in the base image, so bind-mounted files are not root-owned.
"remoteUser": "ubuntu",
"containerEnv": {
// Outside the bind mount, so a Linux restore never fights the host's
// own NuGet cache. docker-build.sh puts this on the host at
// ~/.cache/factorio-nuget; here it is a named volume instead, so it
// survives a rebuild without being shared with the host's SDK.
"NUGET_PACKAGES": "/home/ubuntu/.cache/nuget"
},
"mounts": [
// src/vue/node_modules holds platform-native binaries - esbuild,
// @parcel/watcher, fsevents on a Mac. Sharing the host's copy would
Expand All @@ -30,11 +20,6 @@
"target": "${containerWorkspaceFolder}/src/vue/node_modules",
"type": "volume"
},
{
"source": "factoriotools-nuget-${devcontainerId}",
"target": "/home/ubuntu/.cache/nuget",
"type": "volume"
},
// rust/target is the same problem as node_modules: Linux build output
// in the bind mount would sit beside, and invalidate, a Mac host's own
// cargo builds. A volume keeps them apart and survives a rebuild.
Expand Down Expand Up @@ -66,9 +51,7 @@
"portsAttributes": {
"5173": { "label": "Vite (needs --host)" }
},
// A new volume is root-owned, hence the chown. Submodules are required to
// build the C# - FluteSharp and delaunator-sharp are referenced by the core
// library, CSharp.lua by the transpile - and a fresh clone has none of them.
// A new volume is root-owned, hence the chown.
// The safe.directory line is a no-op under OrbStack, where the mount already
// appears owned by uid 1000; it is insurance on a Linux host whose own uid
// is not 1000, where git otherwise refuses with "dubious ownership" and
Expand All @@ -77,16 +60,10 @@
// planner it produces, and fail without it. It is a release build of the
// planner and its dependencies, so it is the slow step here; the
// Devcontainer section in CLAUDE.md has the measured time.
"postCreateCommand": "sudo chown ubuntu:ubuntu src/vue/node_modules /home/ubuntu/.cache/nuget rust/target /home/ubuntu/.cargo/registry /home/ubuntu/.cargo/git && git config --global --add safe.directory \"${containerWorkspaceFolder}\" && git submodule update --init --recursive && npm --prefix src/vue ci && npm --prefix src/vue run build-wasm",
"postCreateCommand": "sudo chown ubuntu:ubuntu src/vue/node_modules rust/target /home/ubuntu/.cargo/registry /home/ubuntu/.cargo/git && git config --global --add safe.directory \"${containerWorkspaceFolder}\" && npm --prefix src/vue ci && npm --prefix src/vue run build-wasm",
"customizations": {
"vscode": {
"extensions": [
"rust-lang.rust-analyzer",
"Vue.volar",
"ms-dotnettools.csdevkit",
"ms-vscode.powershell",
"sumneko.lua"
],
"extensions": ["rust-lang.rust-analyzer", "Vue.volar"],
"settings": {
// The Cargo workspace is in rust/, not at the repository root.
"rust-analyzer.linkedProjects": ["rust/Cargo.toml"]
Expand Down
9 changes: 0 additions & 9 deletions .dockerignore

This file was deleted.

89 changes: 0 additions & 89 deletions .editorconfig

This file was deleted.

11 changes: 1 addition & 10 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,13 +1,4 @@
# src/lua is generated and CI checks it against a fresh transpile. The manifest
# is written with [Environment]::NewLine, so a Windows regen would otherwise
# produce CRLF and fail that check for no real reason.
*.lua text eol=lf

# Same deal for swagger.json (Swashbuckle CLI), another committed generated file
# CI checks against a fresh regeneration. It is LF today; pinning it keeps a regen
# on a Windows checkout from failing that check on line endings alone.
src/WebApp/swagger.json text eol=lf

# The snapshot tests compare these byte for byte, so pin LF on every checkout.
*.verified.txt text eol=lf working-tree-encoding=UTF-8
*.verified.xml text eol=lf working-tree-encoding=UTF-8
*.verified.json text eol=lf working-tree-encoding=UTF-8
Loading
Loading