Skip to content

Commit

Permalink
Dockerfile for portal-hive development
Browse files Browse the repository at this point in the history
  • Loading branch information
mynameisdaniil committed Sep 20, 2023
1 parent 69a1a98 commit 7b0c883
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 0 deletions.
15 changes: 15 additions & 0 deletions fluffy/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
26 changes: 26 additions & 0 deletions fluffy/tools/docker/Dockerfile.portalhive
Original file line number Diff line number Diff line change
@@ -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
3 changes: 3 additions & 0 deletions fluffy/tools/docker/Dockerfile.portalhive.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
vendor/
build/
.git/

0 comments on commit 7b0c883

Please sign in to comment.