-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add Dockerfile and step-by-step on how to use it
- Loading branch information
Nikita P
committed
Oct 22, 2024
1 parent
42e5f0a
commit 5a8aff0
Showing
2 changed files
with
45 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
|
||
|