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 <[email protected]>
20 lines
369 B
Plaintext
20 lines
369 B
Plaintext
# 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
|