Add Docker image and documentation

This commit is contained in:
Olivier Louvignes 2020-10-22 10:01:51 +02:00
parent cf559225d8
commit b1162041af
5 changed files with 66 additions and 1 deletions

5
.dockerignore Normal file
View File

@ -0,0 +1,5 @@
# Prevent your local modules and debug logs from being
# copied onto your Docker image and possibly overwriting
# modules installed within your image
.git
__pycache__

3
.gitignore vendored
View File

@ -9,4 +9,5 @@ venv/
*.mypy_cache
*.egg-info
*.egg
__pycache__
__pycache__
.DS_Store

15
Dockerfile Normal file
View File

@ -0,0 +1,15 @@
FROM python:3.7-alpine
WORKDIR /app
COPY requirements.txt setup.py ./
COPY eth2deposit ./eth2deposit
RUN apk add --update gcc libc-dev linux-headers
RUN pip3 install -r requirements.txt
RUN python3 setup.py install
ENTRYPOINT [ "python3", "./eth2deposit/deposit.py" ]

View File

@ -1,6 +1,7 @@
VENV_NAME?=venv
VENV_ACTIVATE=. $(VENV_NAME)/bin/activate
PYTHON=${VENV_NAME}/bin/python3.8
DOCKER_IMAGE="ethereum/eth2.0-deposit-cli:latest"
help:
@echo "clean - remove build and Python file artifacts"
@ -51,3 +52,10 @@ build_linux: venv_build
${VENV_NAME}/bin/python -m pip install -r ./build_configs/linux/requirements.txt
export PYTHONHASHSEED=42; \
$(VENV_ACTIVATE) && pyinstaller ./build_configs/linux/build.spec
build_docker:
@docker build --pull -t $(DOCKER_IMAGE) .
run_docker:
@docker run -it --rm $(DOCKER_IMAGE)

View File

@ -201,6 +201,42 @@ See [here](#arguments)
###### Successful message
See [here](#successful-message)
#### Option 4. Use Docker image
##### Step 1. Build the docker image
Run the following command to locally build the docker image:
```sh
make build_docker
```
##### Step 2. Create keys and `deposit_data-*.json`
Run the following command to enter the interactive CLI:
```sh
docker run -it --rm -v $(pwd)/validator_keys:/app/validator_keys ethereum/eth2.0-deposit-cli
```
You can also run the tool with optional arguments:
```sh
docker run -it --rm -v $(pwd)/validator_keys:/app/validator_keys ethereum/eth2.0-deposit-cli --num_validators=<NUM_VALIDATORS> --mnemonic_language=english --folder=<YOUR_FOLDER_PATH>
```
Example for 1 validator on the [Medalla testnet](https://medalla.launchpad.ethereum.org/) using english:
```sh
docker run -it --rm -v $(pwd)/validator_keys:/app/validator_keys ethereum/eth2.0-deposit-cli --num_validators=1 --mnemonic_language=english --chain=medalla
```
###### Arguments
See [here](#arguments)
###### Successful message
See [here](#successful-message)
----
### For Windows users