Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(docker-compose): add env scaffolding instructions #12

Merged
merged 1 commit into from
Jul 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,16 @@ $(GIT_SUBMODULES): %/.git: .gitmodules
$(GIT) submodule init
$(GIT) submodule update $*
@touch $@

.EXPORT_ALL_VARIABLES:

REDIS_PORT=6379
ANVIL_PORT=8545

start:
docker compose up -d
until cast chain-id --rpc-url "http://localhost:${ANVIL_PORT}" 2> /dev/null; do sleep 1; done
cd contracts && forge script --rpc-url "http://localhost:${ANVIL_PORT}" script/Deploy.s.sol:Deploy --private-key 0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80

stop:
docker compose down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,9 @@ Decentralized MLS PoC using a smart contract for group coordination

1. `Foundry`
2. `make deps`

## Scaffold Environment

1. `make start`: This command will start the docker compose instance, and deploy the smart contract to the local network.

2. `make stop`: This command will stop the docker compose instance.
29 changes: 27 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,31 @@
version: "3.8"
services:
redis:
image: redis:7-alpine
image: redis@sha256:0c6f34a2d41992ee1e02d52d712c12ac46c4d5a63efdab74915141a52c529586
entrypoint: ["redis-server", "--port", "${REDIS_PORT}"]
ports:
- 6379:6379
- "${REDIS_PORT}:${REDIS_PORT}"
healthcheck:
test: ["CMD", "redis-cli", "--raw", "incr", "ping"]
interval: 1s
timeout: 3s
retries: 5

anvil:
image: ghcr.io/foundry-rs/foundry:latest
healthcheck:
test:
[
"CMD",
"cast",
"chain-id",
"--rpc-url",
"http://localhost:${ANVIL_PORT}",
]
interval: 5s
timeout: 3s
retries: 5
ports:
- "${ANVIL_PORT}:${ANVIL_PORT}"
entrypoint: ["anvil", "--host", "0.0.0.0"]
platform: linux/amd64
Loading