Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

clients/ethereumjs: Dockerfile support to build Ethereumjs locally #785

Merged
merged 3 commits into from
Jun 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 20 additions & 13 deletions clients/ethereumjs/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,23 +1,30 @@
FROM node:16-alpine as build
RUN apk update && apk add --no-cache bash git jq curl python3 gcc make g++ && rm -rf /var/cache/apk/*
RUN git clone --depth 1 -b develop-v7 https://github.com/ethereumjs/ethereumjs-monorepo.git && \
(cd ethereumjs-monorepo && npm i)
### Build EthereumJS From Git:

FROM node:18-alpine as build

ARG github=ethereumjs/ethereumjs-monorepo
ARG tag=master

RUN echo "Cloning: $github - $tag" \
&& apk update && apk add --no-cache bash git jq curl python3 gcc make g++ \
&& rm -rf /var/cache/apk/* \
&& git clone --depth 1 -b $tag https://github.com/$github \
&& cd ethereumjs-monorepo && npm i

# Create version.txt
RUN cd ethereumjs-monorepo/packages/client && npm ethereumjs --version > /version.txt

ADD ethereumjs.sh /ethereumjs.sh
# Add genesis mapper script, startup script, and enode URL retriever script
ADD genesis.json /genesis.json
ADD mapper.jq /mapper.jq
ADD jwtsecret /jwtsecret
RUN chmod +x /ethereumjs.sh

# Inject the enode id retriever script
RUN mkdir /hive-bin
ADD ethereumjs.sh /ethereumjs.sh
ADD enode.sh /hive-bin/enode.sh
RUN chmod +x /hive-bin/enode.sh
ADD jwtsecret /jwtsecret

ADD genesis.json /genesis.json
# Set execute permissions for scripts
RUN chmod +x /ethereumjs.sh /hive-bin/enode.sh

# Export the usual networking ports to allow outside access to the node
# Expose networking ports
EXPOSE 8545 8546 8551 8547 30303 30303/udp

# NodeJS applications have a default memory limit of 2.5GB.
Expand Down
35 changes: 35 additions & 0 deletions clients/ethereumjs/Dockerfile.local
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
### Build Ethereumjs Locally:
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this can be merged to the main Dockerfile using RUN if to either git clone repo or copy from local

### Requires a copy of ethereumjs-monorepo/ -> hive/clients/ethereumjs/

FROM node:18-alpine

# Default local client path: clients/ethereumjs/<ethereumjs-monorepo>
ARG local_path=ethereumjs-monorepo
COPY $local_path ethereumjs-monorepo

RUN apk update && apk add --no-cache bash git jq curl python3 gcc make g++ && \
&& rm -rf /var/cache/apk/* \
&& cd ethereumjs-monorepo && npm i

# Create version.txt
RUN cd ethereumjs-monorepo/packages/client && npm ethereumjs --version > /version.txt

# Add genesis mapper script, startup script, and enode URL retriever script
ADD genesis.json /genesis.json
ADD mapper.jq /mapper.jq
ADD ethereumjs.sh /ethereumjs.sh
ADD enode.sh /hive-bin/enode.sh
ADD jwtsecret /jwtsecret

# Set execute permissions for scripts
RUN chmod +x /ethereumjs.sh /hive-bin/enode.sh

# Expose networking ports
EXPOSE 8545 8546 8551 8547 30303 30303/udp

# NodeJS applications have a default memory limit of 2.5GB.
# This limit is bit tight, it is recommended to raise the limit
# since memory may spike during certain network conditions.
ENV NODE_OPTIONS=--max_old_space_size=6144

ENTRYPOINT ["/ethereumjs.sh"]