From 6096150637262dc73abc64f9a6ba7cd36ca12215 Mon Sep 17 00:00:00 2001 From: Zeke Foppa <196249+bfops@users.noreply.github.com> Date: Thu, 6 Nov 2025 20:59:37 -1000 Subject: [PATCH] `Dockerfile` fails more cleanly if `.git` is a submodule (#3591) # Description of Changes Our `Dockerfile` runs `COPY . .`. If we're in a submodule rather than a "full" git repo, that causes `.git` to be a in a weird state inside the docker container, where it thinks it's in a submodule even though the parent directory context has been lost. This PR just adds a clear error message early in the process, because this has bitten us a few times. # API and ABI breaking changes None # Expected complexity level and risk 1 # Testing - [x] We appropriately get the failure if we try to `docker build` this from within a submodule. Co-authored-by: Zeke Foppa --- Dockerfile | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Dockerfile b/Dockerfile index 25ad97dad..e37332b8a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,6 +4,15 @@ FROM rust:bookworm AS builder WORKDIR /usr/src/app COPY . . +# If we're in a git submodule, we'll have a corrupted/nonfunctional .git file instead of a proper .git directory. +# To make the errors more sane, remove .git entirely. +RUN if [ -f .git ]; then \ + echo "❌ ERROR: .git is a file (likely a submodule pointer), not a directory." >&2; \ + echo "This will cause errors in the build process, because git operations will fail." >&2; \ + echo "To address this, replace the .git file with a proper .git directory." >&2; \ + exit 1; \ + fi + RUN cargo build -p spacetimedb-standalone -p spacetimedb-cli --release --locked FROM rust:bookworm