Skip to content

Docker boost speedup#770

Merged
nonsense merged 3 commits intofilecoin-project:mainfrom
airenas:docker-boost-speedup
Sep 8, 2022
Merged

Docker boost speedup#770
nonsense merged 3 commits intofilecoin-project:mainfrom
airenas:docker-boost-speedup

Conversation

@airenas
Copy link
Copy Markdown
Contributor

@airenas airenas commented Sep 6, 2022

Resolves #767

This solution adds optimization for building docker image for the boost only, it does not deal with building the lotus.

Improvements:

  1. caches filecoin-ffi build. It was a bit problematic, as a makefile of the filecoin-ffi depends on a git. We don't want the cache to be cleared on any git commit... etc. So I made a solution to do git submodule update before docker build command.
  2. caches go.mod downloads
  3. caches go build using docker's buildkit feature

My rough estimates of the building time:

###########################################################
# building source without docker
$ time (cd ../../ && make debug)
...
real	0m28.465s

###########################################################
# building boost image without using cache
time make build/boost docker_args=--no-cache
...
 => [builder  2/12] RUN apt update && apt install -y       build-essential       bzr pkg-config      63.7s
 => [runner  2/12] RUN apt update && apt install -y       curl       hwloc       jq                  22.0s
...
 => [builder  8/12] RUN make build/.filecoin-install                                                  7.6s 
 => [builder  9/12] COPY go.mod go.sum /go/src/                                                       0.1s 
 => [builder 10/12] RUN go mod download                                                              86.7s 
 => [builder 11/12] COPY . /go/src                                                                    0.5s 
 => [builder 12/12] RUN --mount=type=cache,target=/root/.cache/go-build make debug                   82.9s 
...
real	4m5.430s

###########################################################
# building boost image after modifying any go file 
$ time make build/boost
...
 => CACHED [builder  8/12] RUN make build/.filecoin-install                                           0.0s
 => CACHED [builder  9/12] COPY go.mod go.sum /go/src/                                                0.0s
 => CACHED [builder 10/12] RUN go mod download                                                        0.0s
 => [builder 11/12] COPY . /go/src                                                                    0.5s
 => [builder 12/12] RUN --mount=type=cache,target=/root/.cache/go-build make debug                   26.9s
...
real	0m29.331s

@nonsense nonsense merged commit e0e4bda into filecoin-project:main Sep 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improve image building time for Boost image

2 participants