Skip to content

Commit 1810bcd

Browse files
authored
chore: devnet images using Lotus from DockerHub (#1157)
* Use an official lotus image for docker devnet Implemented as requested in (#1084) * Fix tabs
1 parent 540e134 commit 1810bcd

File tree

3 files changed

+40
-23
lines changed

3 files changed

+40
-23
lines changed

Makefile

Lines changed: 36 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -200,36 +200,53 @@ docsgen-openrpc-boost: docsgen-openrpc-bin
200200

201201
## DOCKER IMAGES
202202
docker_user?=filecoin
203-
lotus_version?=1.19.0-rc1
203+
lotus_version?=v1.19.0
204204
lotus_src_dir?=
205205
ffi_from_source?=0
206+
build_lotus?=0
206207
ifeq ($(lotus_src_dir),)
207-
lotus_src_dir=/tmp/lotus-$(lotus_version)
208-
lotus_checkout_dir=$(lotus_src_dir)
208+
ifeq ($(build_lotus),1)
209+
# v1: building lotus image with provided lotus version
210+
lotus_info_msg=!!! building lotus base image from github: tag $(lotus_version) !!!
211+
lotus_src_dir=/tmp/lotus-$(lotus_version)
212+
lotus_checkout_dir=$(lotus_src_dir)
213+
lotus_build_cmd=docker/lotus-all-in-one
214+
lotus_base_image=$(docker_user)/lotus-all-in-one:dev
215+
else
216+
# v2 (defaut): using lotus image
217+
lotus_base_image?=filecoin/lotus-all-in-one:$(lotus_version)-debug
218+
lotus_info_msg=using lotus image from dockerhub: $(lotus_base_image)
219+
lotus_build_cmd=info/lotus-all-in-one
220+
endif
209221
else
210-
lotus_version=dev
222+
# v3: building lotus image from source
223+
lotus_info_msg=!!! building lotus base image from source: $(lotus_src_dir) !!!
224+
lotus_base_image=$(docker_user)/lotus-all-in-one:dev
225+
lotus_build_cmd=docker/lotus-all-in-one
211226
lotus_checkout_dir=
212227
endif
213-
lotus_test_image=$(docker_user)/lotus-test:$(lotus_version)
214-
docker_build_cmd=docker build --build-arg LOTUS_TEST_IMAGE=$(lotus_test_image) \
228+
docker_build_cmd=docker build --build-arg LOTUS_TEST_IMAGE=$(lotus_base_image) \
215229
--build-arg FFI_BUILD_FROM_SOURCE=$(ffi_from_source) $(docker_args)
216-
217-
### lotus test docker image
218-
info/lotus-test:
219-
@echo Lotus dir = $(lotus_src_dir)
220-
@echo Lotus ver = $(lotus_version)
221-
.PHONY: info/lotus-test
230+
### lotus-all-in-one docker image build
231+
info/lotus-all-in-one:
232+
@echo Docker build info: $(lotus_info_msg)
233+
.PHONY: info/lotus-all-in-one
222234
$(lotus_checkout_dir):
223-
git clone --depth 1 --branch v$(lotus_version) https://github.com/filecoin-project/lotus $@
224-
docker/lotus-test: info/lotus-test | $(lotus_checkout_dir)
235+
git clone --depth 1 --branch $(lotus_version) https://github.com/filecoin-project/lotus $@
236+
docker/lotus-all-in-one: info/lotus-all-in-one | $(lotus_checkout_dir)
237+
# new lotus Dockerfile does not exist for older lotus versions
238+
# temporary use the old Dockerfile.lotus
225239
cd $(lotus_src_dir) && $(docker_build_cmd) -f Dockerfile.lotus --target lotus-test \
226-
-t $(lotus_test_image) .
227-
.PHONY: docker/lotus-test
240+
-t $(lotus_base_image) .
241+
# code using new lotus Dockerfile
242+
# cd $(lotus_src_dir) && $(docker_build_cmd) -f Dockerfile --target lotus-all-in-one \
243+
# -t $(lotus_base_image) --build-arg GOFLAGS=-tags=debug .
244+
.PHONY: docker/lotus-all-in-one
228245

229246
### devnet images
230247
docker/%:
231-
cd docker/devnet/$* && $(docker_build_cmd) -t $(docker_user)/$*-dev:$(lotus_version) \
232-
--build-arg BUILD_VERSION=$(lotus_version) .
248+
cd docker/devnet/$* && DOCKER_BUILDKIT=1 $(docker_build_cmd) -t $(docker_user)/$*-dev:dev \
249+
--build-arg BUILD_VERSION=dev .
233250
docker/boost: build/.update-modules
234251
DOCKER_BUILDKIT=1 $(docker_build_cmd) \
235252
-t $(docker_user)/boost-dev:dev --build-arg BUILD_VERSION=dev \
@@ -245,6 +262,6 @@ docker/booster-bitswap:
245262
-t $(docker_user)/booster-bitswap-dev:dev --build-arg BUILD_VERSION=dev \
246263
-f docker/devnet/Dockerfile.source --target booster-bitswap-dev .
247264
.PHONY: docker/booster-bitswap
248-
docker/all: docker/lotus-test docker/boost docker/booster-http docker/booster-bitswap \
265+
docker/all: $(lotus_build_cmd) docker/boost docker/booster-http docker/booster-bitswap \
249266
docker/lotus docker/lotus-miner
250267
.PHONY: docker/all

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -216,10 +216,10 @@ make docker/all
216216

217217
On ARM-based systems (*Apple M1/M2*) you need to force building Filecoin's Rust libraries from the source
218218
```
219-
make docker/all ffi_from_source=1
219+
make docker/all ffi_from_source=1 build_lotus=1
220220
```
221221

222-
If you need to build containers using a specific version of lotus then provide the version as a parameter, e.g. `make docker/all lotus_version=1.17.0`. The version must be a tag name of [Lotus git repo](https://github.com/filecoin-project/lotus/tags) without `v` prefix. Or you can build using a local source of lotus - `make docker/all lotus_src_dir=<path of lotus source>`. Also, before starting devnet, you need to update versions in the [.env](docker/devnet/.env) file.
222+
If you need to build containers using a specific version of lotus then provide the version as a parameter, e.g. `make docker/all lotus_version=v1.17.0 build_lotus=1`. The version must be a tag name of [Lotus git repo](https://github.com/filecoin-project/lotus/tags). Or you can build using a local source of lotus - `make docker/all lotus_src_dir=<path of lotus source>`.
223223

224224
### Start devnet docker stack
225225

docker/devnet/.env

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
DOCKER_USER=filecoin
2-
LOTUS_IMAGE=${DOCKER_USER}/lotus-dev:1.19.0-rc1
3-
LOTUS_MINER_IMAGE=${DOCKER_USER}/lotus-miner-dev:1.19.0-rc1
2+
LOTUS_IMAGE=${DOCKER_USER}/lotus-dev:dev
3+
LOTUS_MINER_IMAGE=${DOCKER_USER}/lotus-miner-dev:dev
44
BOOST_IMAGE=${DOCKER_USER}/boost-dev:dev
55
BOOSTER_HTTP_IMAGE=${DOCKER_USER}/booster-http-dev:dev
66
BOOSTER_BITSWAP_IMAGE=${DOCKER_USER}/booster-bitswap-dev:dev

0 commit comments

Comments
 (0)