I noticed that, if I build from source, the current working directory will generate a target, and it's huge
~/rust/github.com/vi/websocat(master) » du -sh target
370M target
so, if we have already compiled the source code, and then execute docker build -t vi/websocat:v0.1 ., it will send a huge build context to docker daemon, that will slow down our build speed.
docker build -t v1/websocat:v0.1 .
Sending build context to Docker daemon 385.5MB
Step 1/12 : FROM rust:1.45.0 as cargo-build
........
but when we ignore target dir, the context send to docker daemon is small
docker build -t v1/websocat:v0.1 .
Sending build context to Docker daemon 1.578MB
Step 1/12 : FROM rust:1.45.0 as cargo-build
---> cbcfc3836acd
Step 2/12 : RUN apt-get update && apt-get install -y --no-install-recommends musl-tools
.......
I noticed that, if I build from source, the current working directory will generate a target, and it's huge
so, if we have already compiled the source code, and then execute
docker build -t vi/websocat:v0.1 .
, it will send a huge build context to docker daemon, that will slow down our build speed.but when we ignore
target
dir, the context send to docker daemon is smallthat will speed up build progress.