Send only the source to Docker builds
.dockerignore is now an allowlist (go.mod, go.sum, cmd, internal, web), so data, backups, .env and anything a deploy tool keeps in the project folder never go into the build context. A file changing or failing to read while the context is sent cuts the upload short, which Docker reports as "failed to read dockerfile: unexpected EOF". Also drops a stray blank first line from the Dockerfile. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
dadf835be3
commit
b53faf58fd
2 files changed
+10
-5
No files matched your search
+10
-4
@@ -1,4 +1,10 @@
|
|||||||
.git
|
# Send only what the build needs. Anything else in the project folder
|
||||||
data
|
# (data, backups, .env, files a deploy tool adds) stays out of the build,
|
||||||
.env
|
# so it can't bloat the upload or change while it's being sent.
|
||||||
canon
|
*
|
||||||
|
!go.mod
|
||||||
|
!go.sum
|
||||||
|
!cmd/
|
||||||
|
!internal/
|
||||||
|
!web/
|
||||||
|
**/*_test.go
|
||||||
@@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
FROM golang:1-alpine AS build
|
FROM golang:1-alpine AS build
|
||||||
WORKDIR /src
|
WORKDIR /src
|
||||||
COPY go.mod go.sum ./
|
COPY go.mod go.sum ./
|
||||||
|
|||||||
Reference in new issue
Block a user