add Makefile for beacon_node Dockerfile, make image smaller
Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
parent
46aca468bb
commit
6de2dd167e
|
@ -1,26 +1,41 @@
|
|||
FROM statusteam/nim-base
|
||||
MAINTAINER Zahary Karadjov <zahary@status.im>
|
||||
FROM statusteam/nim-base AS build
|
||||
|
||||
ARG network
|
||||
ARG network_backend
|
||||
RUN apt update \
|
||||
&& apt install -y build-essential make \
|
||||
&& apt clean \
|
||||
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
|
||||
|
||||
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 git clone https://github.com/status-im/nimbus.git \
|
||||
&& cd nimbus \
|
||||
&& make update deps
|
||||
|
||||
RUN git clone https://github.com/status-im/nimbus.git && \
|
||||
cd nimbus && \
|
||||
make update deps
|
||||
ARG NETWORK
|
||||
ARG NETWORK_BACKEND
|
||||
|
||||
RUN cd nimbus && \
|
||||
set -a && \
|
||||
. vendor/nim-beacon-chain/scripts/${network}.env && \
|
||||
./env.sh nim \
|
||||
RUN cd nimbus \
|
||||
&& set -a \
|
||||
&& . vendor/nim-beacon-chain/scripts/${NETWORK}.env \
|
||||
&& ./env.sh nim \
|
||||
-o:/usr/bin/beacon_node \
|
||||
-d:release \
|
||||
-d:with$network_backend \
|
||||
-d:SHARD_COUNT=$SHARD_COUNT \
|
||||
-d:SLOTS_PER_EPOCH=$SLOTS_PER_EPOCH \
|
||||
-d:with${NETWORK_BACKEND} \
|
||||
-d:SHARD_COUNT=${SHARD_COUNT} \
|
||||
-d:SLOTS_PER_EPOCH=${SLOTS_PER_EPOCH} \
|
||||
c vendor/nim-beacon-chain/beacon_chain/beacon_node.nim
|
||||
|
||||
ENTRYPOINT ["beacon_node"]
|
||||
# --------------------------------- #
|
||||
# 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/beacon_node /usr/bin/beacon_node
|
||||
|
||||
MAINTAINER Zahary Karadjov <zahary@status.im>
|
||||
LABEL description="Nimbus installation that can act as an ETH2 network bootstrap node."
|
||||
|
||||
ENTRYPOINT ["/usr/bin/beacon_node"]
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
# These default settings can be overriden by exporting env variables
|
||||
NETWORK ?= testnet0
|
||||
NETWORK_BACKEND ?= rlpx
|
||||
|
||||
IMAGE_TAG ?= $(NETWORK)-$(NETWORK_BACKEND)
|
||||
IMAGE_NAME ?= statusteam/nimbus_beacon_node:$(IMAGE_TAG)
|
||||
|
||||
build: $(NIX_INSTALL)
|
||||
docker build \
|
||||
--build-arg="NETWORK=$(NETWORK)" \
|
||||
--build-arg="NETWORK_BACKEND=$(NETWORK_BACKEND)" \
|
||||
-t $(IMAGE_NAME) .
|
||||
|
||||
push: build
|
||||
docker push $(IMAGE_NAME)
|
|
@ -0,0 +1,3 @@
|
|||
# Description
|
||||
|
||||
This `Dockerfile` defines the image used in the [`infra-nimbus`](https://github.com/status-im/infra-nimbus) fleet of hosts via the [`infra-role-beacon-node`](https://github.com/status-im/infra-role-beacon-node).
|
|
@ -2,21 +2,17 @@
|
|||
|
||||
set -euv
|
||||
|
||||
DOCKERHUB_REPO_NAME=statusteam/nimbus_beacon_node
|
||||
|
||||
buildAndPush() {
|
||||
NETWORK=$1
|
||||
BACKEND=$2
|
||||
CONTAINER_NAME=statusteam/beacon_node_${NETWORK}_${BACKEND}
|
||||
export NETWORK=$1
|
||||
export NETWORK_BACKEND=$2
|
||||
|
||||
docker build -t $CONTAINER_NAME beacon_node \
|
||||
--build-arg network=$NETWORK \
|
||||
--build-arg network_backend=$BACKEND
|
||||
|
||||
docker push $CONTAINER_NAME
|
||||
(cd $(dirname "$0")/beacon_node && make push)
|
||||
}
|
||||
|
||||
buildAndPush testnet0 rlpx
|
||||
buildAndPush testnet1 rlpx
|
||||
|
||||
buildAndPush testnet0 libp2p
|
||||
buildAndPush testnet1 libp2p
|
||||
|
||||
#buildAndPush testnet0 libp2p
|
||||
#buildAndPush testnet1 libp2p
|
||||
|
|
Loading…
Reference in New Issue