From 83bcae01b759e31317fd2c663edfeb720c60e631 Mon Sep 17 00:00:00 2001 From: Salastil Date: Fri, 9 Oct 2026 23:03:02 -0400 Subject: [PATCH] docker: stop shipping the host target dir into the build There was no .dockerignore, so `COPY . .` carried target/ -- three gigabytes of artifacts built by a different toolchain than the builder stage's -- plus cache/ and .git into every build. Mirror .gitignore's allowlist and keep the context to what the build actually reads. The final image is unchanged: the runtime stage only copies the binary, public/ and config/. Co-Authored-By: Claude Opus 5 --- .dockerignore | 19 +++++++++++++++++++ .gitignore | 1 + 2 files changed, 20 insertions(+) create mode 100644 .dockerignore diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..8d7474e --- /dev/null +++ b/.dockerignore @@ -0,0 +1,19 @@ +# Mirrors .gitignore: ignore everything, then allow what the build needs. +# Without this the context carries target/ (gigabytes of host-built +# artifacts, compiled against the wrong toolchain) and cache/ into COPY . . +* + +!Cargo.lock +!Cargo.toml + +# Source +!src/ +!src/** + +# Static assets +!public/ +!public/** + +# Configuration template +!config/ +!config/teapot.example.toml diff --git a/.gitignore b/.gitignore index dbee8e8..05aa06a 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,7 @@ * # Track project files +!.dockerignore !.editorconfig !.envrc !.gitignore