Skip to content

Commit 85b9faf

Browse files
committed
[bfops/fix-dockerfile]: Dockerfile fails more cleanly if .git is a submodule
1 parent 30b8eac commit 85b9faf

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

Dockerfile

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,15 @@ FROM rust:bookworm AS builder
44
WORKDIR /usr/src/app
55
COPY . .
66

7+
# If we're in a git submodule, we'll have a corrupted/nonfunctional .git file instead of a proper .git directory.
8+
# To make the errors more sane, remove .git entirely.
9+
RUN if [ -f .git ]; then \
10+
echo "❌ ERROR: .git is a file (likely a submodule pointer), not a directory." >&2; \
11+
echo "This will cause errors in the build process, because git operations will fail." >&2; \
12+
echo "To address this, replace the .git file with a proper .git directory." >&2; \
13+
exit 1; \
14+
fi
15+
716
RUN cargo build -p spacetimedb-standalone -p spacetimedb-cli --release --locked
817

918
FROM rust:bookworm

0 commit comments

Comments
 (0)