pipecd icon indicating copy to clipboard operation
pipecd copied to clipboard

Improve local Docker build performance by adding a root .dockerignore

Open Prachi194agrawal opened this issue 5 months ago • 5 comments

Problem

make run/pipecd builds the PipeCD control-plane image with:

COPY . .

but the repository does not have a root .dockerignore.

During local development setup, Docker can send a very large build context. In my local setup after running the documented dependency/setup commands, the Docker build context reached approximately 2.5 GB. Repo-local generated directories such as .dev, .cache, .artifacts, and web/node_modules are included even though they are not needed in the image build context.

Impact

  • make run/pipecd is slower than necessary for first-time and repeat local builds
  • Docker daemon disk usage grows unnecessarily
  • Makes the contributor setup experience heavier than expected, especially on first run

Suggested Improvement

Add a root .dockerignore (mirroring the relevant entries from .gitignore) to exclude local/generated directories from the build context. Suggested content:

# Version control
.git

# Local dev environment
.dev
.cache
.artifacts

# Go
vendor

# Node / web
node_modules
web/node_modules
web/dist
web/.cache
web/coverage
docs/node_modules

# Helm chart deps
.rendered-manifests
manifests/pipecd/charts
manifests/piped/charts
manifests/site/charts
manifests/helloworld/charts

# Bazel
bazel-bin
bazel-genfiles
bazel-pipecd
bazel-out
bazel-testlogs

# IDE / OS
.idea
.ijwb
.DS_Store

# Terraform
.terraform

This should significantly reduce the Docker build context size and improve the local contributor experience with no change to the final image contents.

References

  • cmd/pipecd/Dockerfile line 7: COPY . .
  • .gitignore already lists these dirs; .dockerignore entries mirror them

Prachi194agrawal avatar Jun 07 '26 13:06 Prachi194agrawal

would love to work on this issue as i have experience working on a similar issue - https://github.com/apache/hugegraph/pull/3025

bitflicker64 avatar Jun 07 '26 13:06 bitflicker64

@bitflicker64 Actually, I am working on this issue.

Prachi194agrawal avatar Jun 07 '26 13:06 Prachi194agrawal

@bitflicker64 Actually, I am working on this issue.

okay npp!!

bitflicker64 avatar Jun 07 '26 13:06 bitflicker64

Hi @Prachi194agrawal, are you still working on the issue?

kunal-yelgate avatar Jun 23 '26 15:06 kunal-yelgate

Hey @Prachi194agrawal, are you still working on this? If not, would you mind if I take it up?

CodeWith-sakib avatar Jul 08 '26 18:07 CodeWith-sakib