Dockerfile for portal-hive development (#1759)

improves build time for a local dev container for a portal-hive test suite
This commit is contained in:
Daniel Sobol 2023-09-20 19:07:09 +03:00 committed by GitHub
parent 53df21f000
commit bd1a647987
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 44 additions and 0 deletions

View File

@ -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:

View File

@ -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 <<EOF
set -e
make fluffy -j${NPROC}
cp /fluffy/build/fluffy /usr/local/bin/fluffy
EOF
FROM debian:stable-slim as app
COPY --from=build /usr/local/bin/fluffy /usr/local/bin/fluffy

View File

@ -0,0 +1,3 @@
vendor/
build/
.git/