Skip to content

Commit

Permalink
Configurable source and binary repos
Browse files Browse the repository at this point in the history
  • Loading branch information
yorickdowne committed Sep 7, 2023
1 parent 5535b96 commit 48c0cfb
Show file tree
Hide file tree
Showing 52 changed files with 238 additions and 104 deletions.
6 changes: 4 additions & 2 deletions besu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@ services:
context: ./besu
dockerfile: ${BESU_DOCKERFILE}
args:
- BUILD_TARGET=${BESU_SRC_BUILD_TARGET}
- DOCKER_TAG=${BESU_DOCKER_TAG}
- BUILD_TARGET=${BESU_SRC_BUILD_TARGET:-'$(git describe --tags $(git rev-list --tags --max-count=1))'}
- SRC_REPO=${BESU_SRC_REPO:-https://github.com/hyperledger/besu}
- DOCKER_TAG=${BESU_DOCKER_TAG:-latest}
- DOCKER_REPO=${BESU_DOCKER_REPO:-hyperledger/besu}
image: besu:local
user: besu
environment:
Expand Down
4 changes: 3 additions & 1 deletion besu/Dockerfile.binary
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
ARG DOCKER_TAG
ARG DOCKER_REPO

FROM hyperledger/besu:${DOCKER_TAG}
FROM ${DOCKER_REPO}:${DOCKER_TAG}

# Unused but included to avoid warnings
ARG BUILD_TARGET
ARG SRC_REPO

ARG USER=besu
ARG UID=10001
Expand Down
4 changes: 3 additions & 1 deletion besu/Dockerfile.source
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@ FROM eclipse-temurin:17-jdk-jammy as builder

# This is here to avoid build-time complaints
ARG DOCKER_TAG
ARG DOCKER_REPO

ARG BUILD_TARGET
ARG SRC_REPO

RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates git

WORKDIR /usr/src
RUN bash -c "git clone --recurse-submodules -j8 https://github.com/hyperledger/besu.git && cd besu && git config advice.detachedHead false && git fetch --all --tags && if [[ ${BUILD_TARGET} =~ pr-.+ ]]; then git fetch origin pull/$(echo ${BUILD_TARGET} | cut -d '-' -f 2)/head:besu-pr; git checkout besu-pr; else git checkout ${BUILD_TARGET}; fi && ./gradlew installDist"
RUN bash -c "git clone --recurse-submodules -j8 ${SRC_REPO} besu && cd besu && git config advice.detachedHead false && git fetch --all --tags && if [[ ${BUILD_TARGET} =~ pr-.+ ]]; then git fetch origin pull/$(echo ${BUILD_TARGET} | cut -d '-' -f 2)/head:besu-pr; git checkout besu-pr; else git checkout ${BUILD_TARGET}; fi && ./gradlew installDist"

# Pull all binaries into a second stage deploy Ubuntu container
FROM eclipse-temurin:17-jre-jammy
Expand Down
27 changes: 27 additions & 0 deletions default.env
Original file line number Diff line number Diff line change
Expand Up @@ -159,84 +159,111 @@ SSV2_NODE_TAG=latest
# MEV-Boost
# If mev-boost terminates with a SIGILL, make this one of the "portable" tags
MEV_DOCKER_TAG=latest
MEV_DOCKER_REPO=flashbots/mev-boost
MEV_DOCKERFILE=Dockerfile.binary

# Nimbus
# SRC build target can be a tag, a branch, or a pr as "pr-ID"
NIM_SRC_BUILD_TARGET='$(git describe --tags $(git rev-list --tags --max-count=1))'
NIM_SRC_REPO=https://github.com/status-im/nimbus-eth2
NIM_DOCKER_TAG=multiarch-latest
NIM_DOCKER_VC_TAG=multiarch-latest
NIM_DOCKER_REPO=statusim/nimbus-eth2
NIM_DOCKER_VC_REPO=statusim/nimbus-validator-client
NIM_DOCKERFILE=Dockerfile.binary

# Teku
# SRC build target can be a tag, a branch, or a pr as "pr-ID"
TEKU_SRC_BUILD_TARGET='$(git describe --tags $(git rev-list --tags --max-count=1))'
TEKU_SRC_REPO=https://github.com/ConsenSys/teku
TEKU_DOCKER_TAG=latest
TEKU_DOCKER_REPO=consensys/teku
TEKU_DOCKERFILE=Dockerfile.binary

# Lighthouse
# SRC build target can be a tag, a branch, or a pr as "pr-ID"
LH_SRC_BUILD_TARGET=stable
LH_SRC_REPO=https://github.com/sigp/lighthouse
# If Lighthouse terminates with a SIGILL, make this "latest"
LH_DOCKER_TAG=latest-modern
LH_DOCKER_REPO=sigp/lighthouse
LH_DOCKERFILE=Dockerfile.binary

# Prysm
# SRC build target can be a tag, a branch, or a pr as "pr-ID"
PRYSM_SRC_BUILD_TARGET='$(git describe --tags $(git rev-list --tags --max-count=1))'
PRYSM_SRC_REPO=https://github.com/prysmaticlabs/prysm
PRYSM_DOCKER_TAG=stable
PRYSM_DOCKER_VC_TAG=stable
PRYSM_DOCKER_REPO=gcr.io/prysmaticlabs/prysm/beacon-chain
PRYSM_DOCKER_VC_REPO=gcr.io/prysmaticlabs/prysm/validator
PRYSM_DOCKERFILE=Dockerfile.binary

# Lodestar
# SRC build target can be a tag, a branch, or a pr as "pr-ID"
LS_SRC_BUILD_TARGET='$(git describe --tags $(git rev-list --tags --max-count=1))'
LS_SRC_REPO=https://github.com/ChainSafe/lodestar
LS_DOCKER_TAG=latest
LS_DOCKER_REPO=chainsafe/lodestar
LS_DOCKERFILE=Dockerfile.binary

# Web3Signer
W3S_DOCKER_TAG=latest
W3S_DOCKER_REPO=consensys/web3signer
PG_DOCKER_TAG=alpine

# Besu
# SRC build target can be a tag, a branch, or a pr as "pr-ID"
BESU_SRC_BUILD_TARGET='$(git describe --tags $(git rev-list --tags --max-count=1))'
BESU_SRC_REPO=https://github.com/hyperledger/besu
BESU_DOCKER_TAG=latest
BESU_DOCKER_REPO=hyperledger/besu
BESU_DOCKERFILE=Dockerfile.binary

# Erigon
# SRC build target can be a tag, a branch, or a pr as "pr-ID"
ERIGON_SRC_BUILD_TARGET='$(git describe --tags $(git rev-list --tags --max-count=1))'
ERIGON_SRC_REPO=https://github.com/ledgerwatch/erigon
ERIGON_DOCKER_TAG=stable
ERIGON_DOCKER_REPO=thorax/erigon
ERIGON_DOCKERFILE=Dockerfile.binary

# Nethermind
# SRC build target can be a tag, a branch, or a pr as "pr-ID"
NM_SRC_BUILD_TARGET='$(git tag --sort=-committerdate | grep -E "^[0-9]+[.][0-9]+[.][0-9]+$" | head -1)'
NM_SRC_REPO=https://github.com/NethermindEth/nethermind
NM_DOCKER_TAG=latest
NM_DOCKER_REPO=nethermind/nethermind
NM_DOCKERFILE=Dockerfile.binary

# Go-Ethereum aka Geth
# SRC build target can be a tag, a branch, or a pr as "pr-ID"
GETH_SRC_BUILD_TARGET='$(git describe --tags $(git rev-list --tags --max-count=1))'
GETH_SRC_REPO=https://github.com/ethereum/go-ethereum
GETH_DOCKER_TAG=stable
GETH_DOCKER_REPO=ethereum/client-go
GETH_DOCKERFILE=Dockerfile.binary

# Nimbus EL
# SRC build target can be a tag, a branch, or a pr as "pr-ID"
NIMEL_SRC_BUILD_TARGET=master
NIMEL_SRC_REPO=https://github.com/status-im/nimbus-eth1
NIMEL_DOCKER_TAG=nonesuch
NIMEL_DOCKER_REPO=nonesuch
NIMEL_DOCKERFILE=Dockerfile.source

# Reth
# SRC build target can be a tag, a branch, or a pr as "pr-ID"
RETH_SRC_BUILD_TARGET=main
RETH_SRC_REPO=https://github.com/paradigmxyz/reth
RETH_DOCKER_TAG=latest
RETH_DOCKER_REPO=ghcr.io/paradigmxyz/reth
RETH_DOCKERFILE=Dockerfile.binary

# staking-deposit-cli
# SRC build target can be a tag, a branch, or a pr as "pr-ID"
DEPCLI_SRC_BUILD_TARGET='$(git describe --tags $(git rev-list --tags --max-count=1))'
DEPCLI_SRC_REPO=https://github.com/ethereum/staking-deposit-cli
# Does not (yet?) exist on Docker hub
DEPCLI_DOCKER_TAG=nonesuch

Expand Down
9 changes: 6 additions & 3 deletions deposit-cli.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ services:
build:
context: ./staking-deposit-cli
args:
- BUILD_TARGET=${DEPCLI_SRC_BUILD_TARGET}
- BUILD_TARGET=${DEPCLI_SRC_BUILD_TARGET:-'$(git describe --tags $(git rev-list --tags --max-count=1))'}
- SRC_REPO=${DEPCLI_SRC_REPO:-https://github.com/ethereum/staking-deposit-cli}
image: staking-deposit-cli:local
volumes:
- ./.eth:/app/.eth/
Expand All @@ -23,7 +24,8 @@ services:
build:
context: ./staking-deposit-cli
args:
- BUILD_TARGET=${DEPCLI_SRC_BUILD_TARGET}
- BUILD_TARGET=${DEPCLI_SRC_BUILD_TARGET:-'$(git describe --tags $(git rev-list --tags --max-count=1))'}
- SRC_REPO=${DEPCLI_SRC_REPO:-https://github.com/ethereum/staking-deposit-cli}
image: staking-deposit-cli:local
volumes:
- ./.eth:/app/.eth/
Expand All @@ -39,7 +41,8 @@ services:
build:
context: ./staking-deposit-cli
args:
- BUILD_TARGET=${DEPCLI_SRC_BUILD_TARGET}
- BUILD_TARGET=${DEPCLI_SRC_BUILD_TARGET:-'$(git describe --tags $(git rev-list --tags --max-count=1))'}
- SRC_REPO=${DEPCLI_SRC_REPO:-https://github.com/ethereum/staking-deposit-cli}
restart: "no"
image: staking-deposit-cli:local
volumes:
Expand Down
6 changes: 4 additions & 2 deletions erigon.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,10 @@ services:
context: ./erigon
dockerfile: ${ERIGON_DOCKERFILE}
args:
- BUILD_TARGET=${ERIGON_SRC_BUILD_TARGET}
- DOCKER_TAG=${ERIGON_DOCKER_TAG}
- BUILD_TARGET=${ERIGON_SRC_BUILD_TARGET:-'$(git describe --tags $(git rev-list --tags --max-count=1))'}
- SRC_REPO=${ERIGON_SRC_REPO:-https://github.com/ledgerwatch/erigon}
- DOCKER_TAG=${ERIGON_DOCKER_TAG:-stable}
- DOCKER_REPO=${ERIGON_DOCKER_REPO:-thorax/erigon}
stop_grace_period: 5m
image: erigon:local
user: erigon
Expand Down
4 changes: 3 additions & 1 deletion erigon/Dockerfile.binary
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
ARG DOCKER_TAG
ARG DOCKER_REPO

FROM thorax/erigon:${DOCKER_TAG}
FROM ${DOCKER_REPO}:${DOCKER_TAG}

# Unused, this is here to avoid build time complaints
ARG BUILD_TARGET
ARG SRC_REPO

ARG USER=erigon
ARG UID=10001
Expand Down
4 changes: 3 additions & 1 deletion erigon/Dockerfile.source
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@ FROM golang:1.20-alpine as builder

# Unused, this is here to avoid build time complaints
ARG DOCKER_TAG
ARG DOCKER_REPO

ARG BUILD_TARGET
ARG SRC_REPO

RUN apk update && apk add --no-cache make gcc g++ musl-dev linux-headers git bash

WORKDIR /src
RUN bash -c "git clone --recurse-submodules -j8 https://github.com/ledgerwatch/erigon.git && cd erigon && git config advice.detachedHead false && git fetch --all --tags && \
RUN bash -c "git clone --recurse-submodules -j8 ${SRC_REPO} erigon && cd erigon && git config advice.detachedHead false && git fetch --all --tags && \
if [[ ${BUILD_TARGET} =~ pr-.+ ]]; then git fetch origin pull/$(echo ${BUILD_TARGET} | cut -d '-' -f 2)/head:erigon-pr; git checkout erigon-pr; else git checkout ${BUILD_TARGET}; fi && make erigon"

# Pull all binaries into a second stage deploy container
Expand Down
18 changes: 10 additions & 8 deletions ethd
Original file line number Diff line number Diff line change
Expand Up @@ -679,14 +679,16 @@ envmigrate() {
PRYSM_PORT DOPPELGANGER PRYSM_UDP_PORT GRAFANA_PORT PROMETHEUS_PORT KEY_API_PORT TRAEFIK_WEB_PORT TRAEFIK_WEB_HTTP_PORT \
CL_REST_PORT EL_RPC_PORT EL_WS_PORT EE_PORT ERIGON_TORRENT_PORT LOG_LEVEL JWT_SECRET EL_EXTRAS CL_EXTRAS \
VC_EXTRAS ARCHIVE_NODE SSV_P2P_PORT SSV_P2P_PORT_UDP ERIGON_P2P_PORT_2 ERIGON_P2P_PORT_3 )
TARGET_VARS=( NIM_SRC_BUILD_TARGET NIM_DOCKER_TAG NIM_DOCKER_VC_TAG NIM_DOCKERFILE TEKU_SRC_BUILD_TARGET TEKU_DOCKER_TAG \
TEKU_DOCKERFILE LH_SRC_BUILD_TARGET LH_DOCKER_TAG LH_DOCKERFILE PRYSM_SRC_BUILD_TARGET \
PRYSM_DOCKER_TAG PRYSM_DOCKER_VC_TAG PRYSM_DOCKERFILE ERIGON_SRC_BUILD_TARGET ERIGON_DOCKER_TAG \
ERIGON_DOCKERFILE MEV_DOCKERFILE MEV_DOCKER_TAG NIMEL_SRC_BUILD_TARGET NIMEL_DOCKER_TAG NIMEL_DOCKERFILE \
LS_SRC_BUILD_TARGET LS_DOCKER_TAG LS_DOCKERFILE GETH_SRC_BUILD_TARGET GETH_DOCKER_TAG TRAEFIK_TAG DDNS_TAG \
GETH_DOCKERFILE NM_SRC_BUILD_TARGET NM_DOCKER_TAG NM_DOCKERFILE BESU_SRC_BUILD_TARGET \
BESU_DOCKER_TAG BESU_DOCKERFILE SSV_NODE_TAG SSV2_NODE_TAG DEPCLI_SRC_BUILD_TARGET DEPCLI_DOCKER_TAG W3S_DOCKER_TAG \
PG_DOCKER_TAG RETH_SRC_BUILD_TARGET RETH_DOCKER_TAG RETH_DOCKERFILE NODE_EXPORTER_IGNORE_MOUNT_REGEX )
TARGET_VARS=( NIM_SRC_BUILD_TARGET NIM_SRC_REPO NIM_DOCKER_TAG NIM_DOCKER_VC_TAG NIM_DOCKER_REPO NIM_DOCKER_VC_REPO NIM_DOCKERFILE \
TEKU_SRC_BUILD_TARGET TEKU_SRC_REPO TEKU_DOCKER_TAG TEKU_DOCKER_REPO TEKU_DOCKERFILE LH_SRC_BUILD_TARGET LH_SRC_REPO \
LH_DOCKER_TAG LH_DOCKER_REPO LH_DOCKERFILE PRYSM_SRC_BUILD_TARGET PRYSM_SRC_REPO PRYSM_DOCKER_TAG PRYSM_DOCKER_VC_TAG \
PRYSM_DOCKER_REPO PRYSM_DOCKER_VC_REPO PRYSM_DOCKERFILE ERIGON_SRC_BUILD_TARGET ERIGON_SRC_REPO ERIGON_DOCKER_TAG \
ERIGON_DOCKER_REPO ERIGON_DOCKERFILE MEV_DOCKERFILE MEV_DOCKER_TAG MEV_DOCKER_REPO NIMEL_SRC_BUILD_TARGET NIMEL_SRC_REPO \
NIMEL_DOCKER_TAG NIMEL_DOCKER_REPO NIMEL_DOCKERFILE LS_SRC_BUILD_TARGET LS_SRC_REPO LS_DOCKER_TAG LS_DOCKER_REPO LS_DOCKERFILE \
GETH_SRC_BUILD_TARGET GETH_SRC_REPO GETH_DOCKER_TAG GETH_DOCKER_REPO TRAEFIK_TAG DDNS_TAG GETH_DOCKERFILE NM_SRC_BUILD_TARGET \
NM_SRC_REPO NM_DOCKER_TAG NM_DOCKER_REPO NM_DOCKERFILE BESU_SRC_BUILD_TARGET BESU_SRC_REPO BESU_DOCKER_TAG BESU_DOCKER_REPO \
BESU_DOCKERFILE SSV_NODE_TAG SSV2_NODE_TAG DEPCLI_SRC_BUILD_TARGET DEPCLI_SRC_REPO DEPCLI_DOCKER_TAG W3S_DOCKER_TAG W3S_DOCKER_REPO \
PG_DOCKER_TAG RETH_SRC_BUILD_TARGET RETH_SRC_REPO RETH_DOCKER_TAG RETH_DOCKER_REPO RETH_DOCKERFILE NODE_EXPORTER_IGNORE_MOUNT_REGEX )
OLD_VARS=( LH_PORT PRYSM_WEB_PORT EC_NODE REWARDS_TO GETH_CACHE CF_API_TOKEN \
EC_HOST EC_LB EC_WS_HOST EC_WS_LB CC_HOST CC_LB EC_P2P_PORT CC_NODE CC_P2P_PORT EC_RPC_PORT EC_WS_PORT )
NEW_VARS=( CL_P2P_PORT KEY_API_PORT EL_NODE FEE_RECIPIENT EL_EXTRAS CF_DNS_API_TOKEN \
Expand Down
3 changes: 2 additions & 1 deletion flashbots/Dockerfile.binary
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
ARG DOCKER_TAG
FROM flashbots/mev-boost:${DOCKER_TAG} as mev
ARG DOCKER_REPO
FROM ${DOCKER_REPO}:${DOCKER_TAG}

ARG USER=mev
ARG UID=10666
Expand Down
6 changes: 4 additions & 2 deletions geth.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,10 @@ services:
context: ./geth
dockerfile: ${GETH_DOCKERFILE}
args:
- BUILD_TARGET=${GETH_SRC_BUILD_TARGET}
- DOCKER_TAG=${GETH_DOCKER_TAG}
- BUILD_TARGET=${GETH_SRC_BUILD_TARGET:-'$(git describe --tags $(git rev-list --tags --max-count=1))'}
- SRC_REPO=${GETH_SRC_REPO:-https://github.com/ethereum/go-ethereum}
- DOCKER_TAG=${GETH_DOCKER_TAG:-stable}
- DOCKER_REPO=${GETH_DOCKER_REPO:-ethereum/client-go}
stop_grace_period: 5m
image: geth:local
user: geth
Expand Down
4 changes: 3 additions & 1 deletion geth/Dockerfile.binary
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
ARG DOCKER_TAG
ARG DOCKER_REPO

FROM ethereum/client-go:${DOCKER_TAG}
FROM ${DOCKER_REPO}:${DOCKER_TAG}

# Unused, this is here to avoid build time complaints
ARG BUILD_TARGET
ARG SRC_REPO

ARG USER=geth
ARG UID=10001
Expand Down
4 changes: 3 additions & 1 deletion geth/Dockerfile.source
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@ FROM golang:1.21-alpine as builder

# Unused, this is here to avoid build time complaints
ARG DOCKER_TAG
ARG DOCKER_REPO

ARG BUILD_TARGET
ARG SRC_REPO

RUN apk update && apk add --no-cache make gcc musl-dev linux-headers git bash

WORKDIR /src
RUN bash -c "git clone https://github.com/ethereum/go-ethereum.git && cd go-ethereum && git config advice.detachedHead false && git fetch --all --tags && \
RUN bash -c "git clone ${SRC_REPO} go-ethereum && cd go-ethereum && git config advice.detachedHead false && git fetch --all --tags && \
if [[ ${BUILD_TARGET} =~ pr-.+ ]]; then git fetch origin pull/$(echo ${BUILD_TARGET} | cut -d '-' -f 2)/head:geth-pr; git checkout geth-pr; else git checkout ${BUILD_TARGET}; fi && \
go run build/ci.go install -static"

Expand Down
6 changes: 4 additions & 2 deletions lighthouse-cl-only.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@ x-build: &lh-build
context: ./lighthouse
dockerfile: ${LH_DOCKERFILE}
args:
- BUILD_TARGET=${LH_SRC_BUILD_TARGET}
- DOCKER_TAG=${LH_DOCKER_TAG}
- BUILD_TARGET=${LH_SRC_BUILD_TARGET:-stable}
- SRC_REPO=${LH_SRC_REPO:-https://github.com/sigp/lighthouse}
- DOCKER_TAG=${LH_DOCKER_TAG:-latest-modern}
- DOCKER_REPO=${LH_DOCKER_REPO:-sigp/lighthouse}

services:
consensus:
Expand Down
6 changes: 4 additions & 2 deletions lighthouse-vc-only.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@ x-build: &lh-build
context: ./lighthouse
dockerfile: ${LH_DOCKERFILE}
args:
- BUILD_TARGET=${LH_SRC_BUILD_TARGET}
- DOCKER_TAG=${LH_DOCKER_TAG}
- BUILD_TARGET=${LH_SRC_BUILD_TARGET:-stable}
- SRC_REPO=${LH_SRC_REPO:-https://github.com/sigp/lighthouse}
- DOCKER_TAG=${LH_DOCKER_TAG:-latest-modern}
- DOCKER_REPO=${LH_DOCKER_REPO:-sigp/lighthouse}

services:
validator:
Expand Down
6 changes: 4 additions & 2 deletions lighthouse.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@ x-build: &lh-build
context: ./lighthouse
dockerfile: ${LH_DOCKERFILE}
args:
- BUILD_TARGET=${LH_SRC_BUILD_TARGET}
- DOCKER_TAG=${LH_DOCKER_TAG}
- BUILD_TARGET=${LH_SRC_BUILD_TARGET:-stable}
- SRC_REPO=${LH_SRC_REPO:-https://github.com/sigp/lighthouse}
- DOCKER_TAG=${LH_DOCKER_TAG:-latest-modern}
- DOCKER_REPO=${LH_DOCKER_REPO:-sigp/lighthouse}

services:
consensus:
Expand Down
4 changes: 3 additions & 1 deletion lighthouse/Dockerfile.binary
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
ARG DOCKER_TAG
ARG DOCKER_REPO

FROM sigp/lighthouse:${DOCKER_TAG}
FROM ${DOCKER_REPO}:${DOCKER_TAG}

# Unused, this is here to avoid build time complaints
ARG BUILD_TARGET
ARG SRC_REPO

ARG USER=lhconsensus
ARG UID=10002
Expand Down
19 changes: 6 additions & 13 deletions lighthouse/Dockerfile.source
Original file line number Diff line number Diff line change
@@ -1,28 +1,21 @@
# Build Lighthouse in a stock Rust build container
FROM rust:bookworm as builder
# mallinfo2 is useful for memory troubleshooting but requires glibc 2.33. Debian Bullseye ships with 2.31
#FROM ubuntu:jammy as builder

# Unused, this is here to avoid build time complaints
ARG DOCKER_TAG
ARG DOCKER_REPO

ARG BUILD_TARGET
ARG SRC_REPO
ENV FEATURES modern,gnosis,slasher-lmdb,jemalloc

RUN apt-get update && apt-get -y dist-upgrade && apt-get install -y cmake libclang-dev protobuf-compiler
# Need a bit more in Ubuntu
#RUN apt-get update && apt-get -y dist-upgrade && apt-get install -y cmake libclang-dev build-essential git curl protobuf-compiler

#RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | bash -s -- -y
#ENV PATH="/root/.cargo/bin:${PATH}"

WORKDIR /usr/src
RUN bash -c "git clone https://github.com/sigp/lighthouse.git && cd lighthouse && git config advice.detachedHead false && git fetch --all --tags && if [[ ${BUILD_TARGET} =~ pr-.+ ]]; then git fetch origin pull/$(echo ${BUILD_TARGET} | cut -d '-' -f 2)/head:lh-pr; git checkout lh-pr; else git checkout ${BUILD_TARGET}; fi && CROSS_PROFILE=maxperf make"
RUN bash -c "git clone ${SRC_REPO} lighthouse && cd lighthouse && git config advice.detachedHead false && git fetch --all --tags && if [[ ${BUILD_TARGET} =~ pr-.+ ]]; then git fetch origin pull/$(echo ${BUILD_TARGET} | cut -d '-' -f 2)/head:lh-pr; git checkout lh-pr; else git checkout ${BUILD_TARGET}; fi && CROSS_PROFILE=maxperf make"

# Pull all binaries into a second stage deploy debian container
FROM debian:bookworm-slim
# mallinfo2 is useful for memory troubleshooting but requires glibc 2.33. Debian Bullseye ships with 2.31
#FROM ubuntu:jammy

# Unused, this is here to avoid build time complaints
ARG DOCKER_TAG

RUN set -eux; \
apt-get update; \
Expand Down
Loading

0 comments on commit 48c0cfb

Please sign in to comment.