From bd1a647987be6b4633cfc7d44126ed33032f65f7 Mon Sep 17 00:00:00 2001 From: Daniel Sobol Date: Wed, 20 Sep 2023 19:07:09 +0300 Subject: [PATCH] Dockerfile for portal-hive development (#1759) improves build time for a local dev container for a portal-hive test suite --- fluffy/README.md | 15 +++++++++++ fluffy/tools/docker/Dockerfile.portalhive | 26 +++++++++++++++++++ .../docker/Dockerfile.portalhive.dockerignore | 3 +++ 3 files changed, 44 insertions(+) create mode 100644 fluffy/tools/docker/Dockerfile.portalhive create mode 100644 fluffy/tools/docker/Dockerfile.portalhive.dockerignore diff --git a/fluffy/README.md b/fluffy/README.md index b55a3eee1..b061b9eb9 100644 --- a/fluffy/README.md +++ b/fluffy/README.md @@ -157,6 +157,21 @@ The code follows the [Status Nim Style Guide](https://status-im.github.io/nim-style-guide/). +## Build local dev container for portal-hive + +To develop code against portal-hive tests you will need: + +1) Clone and build portal-hive ([#1](https://github.com/ethereum/portal-hive)) + +2) Modify `Dockerfile` for fluffy in `portal-hive/clients/fluffy/Dockerfile` ([#2](https://github.com/ethereum/portal-hive/blob/main/docs/overview.md#running-a-client-built-from-source)) + +3) Build local dev container using following command: ```docker build --tag fluffy-dev --file ./fluffy/tools/docker/Dockerfile.portalhive .``` You may need to change fluffy-dev to the tag you using in portal-hive client dockerfile. + +4) Run the tests + +Also keep in mind that `./vendors` is dockerignored and cached. If you have to make local changes to one of the dependencies in that directory you'll have to remove `vendors/` from `./fluffy/tools/docker/Dockerfile.portalhive.dockerignore`. + + ## Metrics and their visualisation To enable metrics run Fluffy with the `--metrics` flag: diff --git a/fluffy/tools/docker/Dockerfile.portalhive b/fluffy/tools/docker/Dockerfile.portalhive new file mode 100644 index 000000000..24e540725 --- /dev/null +++ b/fluffy/tools/docker/Dockerfile.portalhive @@ -0,0 +1,26 @@ +FROM debian:stable-slim as build + +ENV DEBIAN_FRONTEND=noninteractive TZ="Etc/UTC" +ENV NPROC=2 + +RUN apt update \ + && apt install make bash build-essential git -y \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* + +COPY ../../ /fluffy + +WORKDIR /fluffy + +RUN --mount=type=cache,target=/fluffy/vendor \ + make deps -j${NPROC} + +RUN --mount=type=cache,target=/fluffy/vendor <