From 5a8aff08719251f0171694a02be19324b7c45f56 Mon Sep 17 00:00:00 2001 From: Nikita P Date: Tue, 22 Oct 2024 12:38:03 +0000 Subject: [PATCH] feat: add Dockerfile and step-by-step on how to use it --- Dockerfile | 16 ++++++++++++++++ README.md | 29 +++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..db77a44a --- /dev/null +++ b/Dockerfile @@ -0,0 +1,16 @@ +FROM nikolaik/python-nodejs:python3.10-nodejs18-bullseye + +USER root + +RUN corepack prepare yarn@1.22 --activate +RUN poetry self update 1.8.2 + +WORKDIR /home/root/scripts + +COPY . . + +RUN poetry install +RUN yarn +RUN poetry run brownie networks import network-config.yaml True + +CMD ["bash"] diff --git a/README.md b/README.md index 7d8a1210..ae4cbe59 100644 --- a/README.md +++ b/README.md @@ -76,6 +76,35 @@ poetry shell ``` ## ⚗️ Workflow +### 🐳 Docker +#### The no-brainer workflow to run tests on any machine with **only Docker** installed +Clone repo and build a fresh image: +```shell +user@local:~# git clone git@github.com:lidofinance/scripts.git +user@local:~# cd scripts +user@local:~/scripts# docker build -t scripts-env . +``` +Run the container filling all ENV VARs: +```shell +user@local:~/scripts# docker run \ + -e PINATA_CLOUD_TOKEN="" \ + -e WEB3_INFURA_PROJECT_ID="" \ + -e DEPLOYER="" \ + -it scripts-env bash +``` +You are now inside the docker container, ready to run tests: +```shell +root@container:~/scripts# poetry run brownie test +``` +If new tests have been added/branches switched/etc. outside the container - update files inside the running container: +```shell +# find the container id: +user@local:~/scripts# docker ps -a + +# update files: +user@local:~/scripts# docker exec rm -rf /home/root/scripts/* +user@local:~/scripts# docker cp . :/home/root/scripts +``` ### Network setup