mirror of
https://github.com/clockworklabs/SpacetimeDB.git
synced 2026-05-06 07:26:43 -04:00
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 <bfops@users.noreply.github.com>
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user