websocat icon indicating copy to clipboard operation
websocat copied to clipboard

add .dockerignore

Open brownchow opened this issue 3 years ago • 1 comments

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
.......

that will speed up build progress.

brownchow avatar Dec 08 '20 16:12 brownchow