Skip to content

Commit

Permalink
Switch to ethstaker-deposit-cli
Browse files Browse the repository at this point in the history
  • Loading branch information
yorickdowne committed Nov 26, 2024
1 parent 671603b commit 9d43d09
Show file tree
Hide file tree
Showing 6 changed files with 79 additions and 31 deletions.
9 changes: 5 additions & 4 deletions default.env
Original file line number Diff line number Diff line change
Expand Up @@ -329,9 +329,10 @@ 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
DEPCLI_SRC_REPO=https://github.com/eth-educators/ethstaker-deposit-cli
DEPCLI_DOCKER_TAG=latest
DEPCLI_DOCKER_REPO=ghcr.io/eth-educators/ethstaker-deposit-cli
DEPCLI_DOCKERFILE=Dockerfile.binary

# traefik and ddns-updater
TRAEFIK_TAG=v3.1
Expand All @@ -343,4 +344,4 @@ NODE_EXPORTER_IGNORE_MOUNT_REGEX='^/(dev|proc|sys|run|var/lib/docker/.+)($|/)'
DOCKER_ROOT=/var/lib/docker

# Used by ethd update - please do not adjust
ENV_VERSION=20
ENV_VERSION=21
36 changes: 24 additions & 12 deletions deposit-cli.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,56 +3,68 @@ services:
profiles: ["tools"]
restart: "no"
build:
context: ./staking-deposit-cli
context: ./ethstaker-deposit-cli
dockerfile: ${DEPCLI_DOCKERFILE}
args:
- 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
- SRC_REPO=${DEPCLI_SRC_REPO:-https://github.com/eth-educators/ethstaker-deposit-cli}
- DOCKER_TAG=${DEPLCI_DOCKER_TAG:-latest}
- DOCKER_REPO=${DEPLCI_DOCKER_REPO:-ghcr.io/eth-educators/ethstaker-deposit-cli}
image: ethstaker-deposit-cli:local
pull_policy: never
volumes:
- ./.eth:/app/.eth/
entrypoint:
- docker-entrypoint.sh
- python3
- /app/staking_deposit/deposit.py
- -m
- ethstaker_deposit
- new-mnemonic
- --chain
- ${NETWORK}
deposit-cli-existing:
profiles: ["tools"]
restart: "no"
build:
context: ./staking-deposit-cli
context: ./ethstaker-deposit-cli
dockerfile: ${DEPCLI_DOCKERFILE}
args:
- 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
- SRC_REPO=${DEPCLI_SRC_REPO:-https://github.com/eth-educators/ethstaker-deposit-cli}
- DOCKER_TAG=${DEPLCI_DOCKER_TAG:-latest}
- DOCKER_REPO=${DEPLCI_DOCKER_REPO:-ghcr.io/eth-educators/ethstaker-deposit-cli}
image: ethstaker-deposit-cli:local
pull_policy: never
volumes:
- ./.eth:/app/.eth/
entrypoint:
- docker-entrypoint.sh
- python3
- /app/staking_deposit/deposit.py
- -m
- ethstaker_deposit
- existing-mnemonic
- --chain
- ${NETWORK}
deposit-cli-change:
profiles: ["tools"]
build:
context: ./staking-deposit-cli
context: ./ethstaker-deposit-cli
dockerfile: ${DEPCLI_DOCKERFILE}
args:
- 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}
- SRC_REPO=${DEPCLI_SRC_REPO:-https://github.com/eth-educators/ethstaker-deposit-cli}
- DOCKER_TAG=${DEPLCI_DOCKER_TAG:-latest}
- DOCKER_REPO=${DEPLCI_DOCKER_REPO:-ghcr.io/eth-educators/ethstaker-deposit-cli}
restart: "no"
image: staking-deposit-cli:local
image: ethstaker-deposit-cli:local
pull_policy: never
volumes:
- ./.eth:/app/.eth
entrypoint:
- docker-entrypoint.sh
- python3
- /app/staking_deposit/deposit.py
- -m
- ethstaker_deposit
- generate-bls-to-execution-change
- --chain
- ${NETWORK}
10 changes: 8 additions & 2 deletions ethd
Original file line number Diff line number Diff line change
Expand Up @@ -1199,10 +1199,10 @@ __env_migrate() {
GETH_SRC_BUILD_TARGET GETH_SRC_REPO GETH_DOCKER_TAG GETH_DOCKER_REPO TRAEFIK_TAG DDNS_TAG CB_PBS_DOCKER_TAG \
GETH_DOCKERFILE NM_SRC_BUILD_TARGET NM_SRC_REPO NM_DOCKER_TAG NM_DOCKER_REPO NM_DOCKERFILE CB_PBS_DOCKER_REPO \
BESU_SRC_BUILD_TARGET BESU_SRC_REPO BESU_DOCKER_TAG BESU_DOCKER_REPO BESU_DOCKERFILE SSV_NODE_TAG CHARON_VERSION \
DEPCLI_SRC_BUILD_TARGET DEPCLI_SRC_REPO DEPCLI_DOCKER_TAG W3S_DOCKER_TAG W3S_DOCKER_REPO \
DEPCLI_SRC_BUILD_TARGET DEPCLI_SRC_REPO DEPCLI_DOCKER_TAG DEPCLI_DOCKER_REPO W3S_DOCKER_TAG W3S_DOCKER_REPO \
PG_DOCKER_TAG RETH_SRC_BUILD_TARGET RETH_SRC_REPO RETH_DOCKER_TAG RETH_DOCKER_REPO RETH_DOCKERFILE \
GRANDINE_SRC_BUILD_TARGET GRANDINE_SRC_REPO GRANDINE_DOCKER_TAG GRANDINE_DOCKER_REPO GRANDINE_DOCKERFILE \
SIREN_DOCKER_TAG SIREN_DOCKER_REPO SSV_DKG_TAG NODE_EXPORTER_IGNORE_MOUNT_REGEX DOCKER_ROOT )
SIREN_DOCKER_TAG SIREN_DOCKER_REPO SSV_DKG_TAG NODE_EXPORTER_IGNORE_MOUNT_REGEX DOCKER_ROOT DEPCLI_DOCKERFILE )

__old_vars=( )
__new_vars=( )
Expand Down Expand Up @@ -1322,6 +1322,12 @@ __env_migrate() {
if [[ "${__var}" = "SSV_NODE_REPO" && "${__value}" = "bloxstaking/ssv-node" ]]; then # SSV new repo
__value="ssvlabs/ssv-node"
fi
if [[ "${__var}" = "DEPCLI_SRC_REPO" && "${__source_ver}" -lt "21" ]]; then
__value="https://github.com/eth-educators/ethstaker-deposit-cli"
fi
if [[ "${__var}" = "DEPCLI_DOCKER_TAG" && "${__value}" = "nonesuch" ]]; then
__value="latest"
fi
__update_value_in_env "${__var}" "$__value" "${__env_file}"
fi
done
Expand Down
30 changes: 30 additions & 0 deletions ethstaker-deposit-cli/Dockerfile.binary
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
ARG DOCKER_TAG=latest
ARG DOCKER_REPO=ghcr.io/eth-educators/ethstaker-deposit-cli

FROM ${DOCKER_REPO}:${DOCKER_TAG}

ARG BUILD_TARGET
ARG SRC_REPO

ARG USER=depcli
ARG UID=1000

# See https://stackoverflow.com/a/55757473/12429735RUN
RUN adduser \
--disabled-password \
--gecos "" \
--home "/nonexistent" \
--shell "/sbin/nologin" \
--no-create-home \
--uid "${UID}" \
"${USER}"

RUN apt-get update && apt-get install -y gosu

WORKDIR /app

RUN chown -R ${USER}:${USER} /app

COPY ./docker-entrypoint.sh /usr/local/bin/

ENTRYPOINT [ "python3", "-m", "ethstaker_deposit" ]
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
FROM python:3.10-alpine AS builder
#FROM python:3.12-alpine AS builder
FROM python:3.13-bookworm AS builder

ARG BUILD_TARGET
ARG SRC_REPO

ARG DOCKER_TAG
ARG DOCKER_REPO

RUN mkdir -p /src

RUN apk add --update bash git
RUN apt-get update && apt-get install -y bash git

WORKDIR /src
RUN bash -c "git clone ${SRC_REPO} staking-deposit-cli && cd staking-deposit-cli && git config advice.detachedHead false && git fetch --all --tags \
RUN bash -c "git clone ${SRC_REPO} ethstaker-deposit-cli && cd ethstaker-deposit-cli && 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:deposit-pr; git checkout deposit-pr; else git checkout ${BUILD_TARGET}; fi"

FROM python:3.10-alpine
#FROM python:3.11-alpine
FROM python:3.13-bookworm

ARG USER=depcli
ARG UID=1000
Expand All @@ -30,17 +31,15 @@ RUN adduser \

WORKDIR /app

COPY --from=builder /src/staking-deposit-cli/requirements.txt /src/staking-deposit-cli/setup.py ./
COPY --from=builder /src/staking-deposit-cli/staking_deposit ./staking_deposit
COPY --from=builder /src/ethstaker-deposit-cli/requirements.txt ./
COPY --from=builder /src/ethstaker-deposit-cli/ethstaker_deposit ./ethstaker_deposit

RUN apk add --update gcc libc-dev linux-headers bash su-exec
RUN apt-get update && apt-get install -y build-essential bash gosu

RUN pip3 install -r requirements.txt

RUN python3 setup.py install

RUN chown -R ${USER}:${USER} /app

COPY ./docker-entrypoint.sh /usr/local/bin/

ENTRYPOINT [ "docker-entrypoint.sh","python3","./staking_deposit/deposit.py" ]
ENTRYPOINT [ "python3", "-m", "ethstaker_deposit" ]
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ for i in "${!ARGS[@]}"; do
fi
done

su-exec depcli "${ARGS[@]}"
gosu depcli "${ARGS[@]}"

if [[ "$*" =~ "generate-bls-to-execution-change" ]]; then
cp -rp /app/bls_to_execution_changes /app/.eth/
Expand Down

0 comments on commit 9d43d09

Please sign in to comment.