Skip to content

Commit

Permalink
feat: add Dockerfile and step-by-step on how to use it
Browse files Browse the repository at this point in the history
  • Loading branch information
Nikita P committed Oct 22, 2024
1 parent 42e5f0a commit 5a8aff0
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 0 deletions.
16 changes: 16 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
FROM nikolaik/python-nodejs:python3.10-nodejs18-bullseye

USER root

RUN corepack prepare [email protected] --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"]
29 changes: 29 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 [email protected]: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="<FILL>" \
-e WEB3_INFURA_PROJECT_ID="<FILL>" \
-e DEPLOYER="<FILL>" \
-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 <CONTAINER_ID> rm -rf /home/root/scripts/*
user@local:~/scripts# docker cp . <CONTAINER_ID>:/home/root/scripts
```

### Network setup

Expand Down

0 comments on commit 5a8aff0

Please sign in to comment.