diff --git a/docker/beacon_node/Dockerfile b/docker/beacon_node/Dockerfile index 37653519d..2b379b217 100644 --- a/docker/beacon_node/Dockerfile +++ b/docker/beacon_node/Dockerfile @@ -5,8 +5,11 @@ RUN apt update \ && apt clean \ && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* +ARG GIT_REVISION + RUN git clone https://github.com/status-im/nimbus.git \ && cd nimbus \ + && git reset --hard ${GIT_REVISION} \ && make update deps ARG NETWORK @@ -18,6 +21,7 @@ RUN cd nimbus \ && ./env.sh nim \ -o:/usr/bin/beacon_node \ -d:release \ + --lineTrace:on \ -d:with${NETWORK_BACKEND} \ -d:SHARD_COUNT=${SHARD_COUNT} \ -d:SLOTS_PER_EPOCH=${SLOTS_PER_EPOCH} \ @@ -29,7 +33,7 @@ RUN cd nimbus \ FROM debian:9-slim RUN apt update \ - && apt install -y librocksdb-dev \ + && apt install -y librocksdb-dev curl \ && apt clean \ && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* diff --git a/docker/beacon_node/Makefile b/docker/beacon_node/Makefile index 92399ed84..fb0d4a009 100644 --- a/docker/beacon_node/Makefile +++ b/docker/beacon_node/Makefile @@ -1,4 +1,7 @@ # These default settings can be overriden by exporting env variables + +GIT_REVISION ?= $(git rev-parse HEAD) + NETWORK ?= testnet0 NETWORK_BACKEND ?= rlpx @@ -7,6 +10,7 @@ IMAGE_NAME ?= statusteam/nimbus_beacon_node:$(IMAGE_TAG) build: $(NIX_INSTALL) docker build \ + --build-arg="GIT_REVISION=$(GIT_REVISION)" \ --build-arg="NETWORK=$(NETWORK)" \ --build-arg="NETWORK_BACKEND=$(NETWORK_BACKEND)" \ -t $(IMAGE_NAME) . diff --git a/docker/build_beacon_node.sh b/docker/build_beacon_node.sh index f1b08861b..a1c6aabdf 100755 --- a/docker/build_beacon_node.sh +++ b/docker/build_beacon_node.sh @@ -2,13 +2,13 @@ set -euv -DOCKERHUB_REPO_NAME=statusteam/nimbus_beacon_node +cd $(dirname "$0") buildAndPush() { export NETWORK=$1 export NETWORK_BACKEND=$2 - (cd $(dirname "$0")/beacon_node && make push) + (cd beacon_node && make push) } buildAndPush testnet0 rlpx diff --git a/docker/build_nimbus.sh b/docker/build_nimbus.sh index 06727552c..902cdecf2 100755 --- a/docker/build_nimbus.sh +++ b/docker/build_nimbus.sh @@ -1,9 +1,7 @@ #!/bin/bash set -euv +cd $(dirname "$0") -CONTAINER_NAME=statusteam/nimbus - -docker build -t $CONTAINER_NAME nimbus -docker push $CONTAINER_NAME +(cd nimbus && make push) diff --git a/docker/nimbus/Dockerfile b/docker/nimbus/Dockerfile index e1035a7f6..405e89db1 100644 --- a/docker/nimbus/Dockerfile +++ b/docker/nimbus/Dockerfile @@ -1,16 +1,35 @@ -FROM statusteam/nim-base -MAINTAINER Zahary Karadjov +FROM statusteam/nim-base AS build -RUN apt-get update && apt-get install -y build-essential make librocksdb-dev && \ - apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* +RUN apt update \ + && apt install -y build-essential make \ + && apt clean \ + && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* -RUN git clone https://github.com/status-im/nimbus.git && \ - cd nimbus && \ - make update deps +ARG GIT_REVISION + +RUN git clone https://github.com/status-im/nimbus.git \ + && cd nimbus \ + && git reset --hard ${GIT_REVISION} \ + && make update deps RUN cd nimbus && \ make nimbus && \ mv build/nimbus /usr/bin/ -ENTRYPOINT ["nimbus"] +# --------------------------------- # +# Starting new image to reduce size # +# --------------------------------- # +FROM debian:9-slim + +RUN apt update \ + && apt install -y librocksdb-dev \ + && apt clean \ + && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* + +COPY --from=build /usr/bin/nimbus /usr/bin/nimbus + +MAINTAINER Zahary Karadjov +LABEL description="Nimbus: an Ethereum 2.0 Sharding Client for Resource-Restricted Devices" + +ENTRYPOINT ["/usr/bin/nimbus"] diff --git a/docker/nimbus/Makefile b/docker/nimbus/Makefile new file mode 100644 index 000000000..e322538d2 --- /dev/null +++ b/docker/nimbus/Makefile @@ -0,0 +1,15 @@ +# These default settings can be overriden by exporting env variables + +GIT_REVISION ?= $(git rev-parse HEAD) + +IMAGE_TAG ?= nimbus_latest +IMAGE_NAME ?= statusteam/nimbus_beacon_node:$(IMAGE_TAG) + +build: $(NIX_INSTALL) + docker build \ + --build-arg="GIT_REVISION=$(GIT_REVISION)" \ + -t $(IMAGE_NAME) . + +push: build + docker push $(IMAGE_NAME) + diff --git a/vendor/nim-beacon-chain b/vendor/nim-beacon-chain index 13c7f7fce..8adffc3f0 160000 --- a/vendor/nim-beacon-chain +++ b/vendor/nim-beacon-chain @@ -1 +1 @@ -Subproject commit 13c7f7fcec8a1694f5523e38a9dd3990861e6c80 +Subproject commit 8adffc3f0ffb1d2212452d3d015d03b7652a1887