Skip to content
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
7 changes: 4 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@ out/
.ignore/

# Ignores development broadcast logs
!/broadcast
/broadcast/*/31337/
/broadcast/**/dry-run/
broadcast/

# Docs
docs/
Expand All @@ -18,3 +16,6 @@ docs/
.env
.env.*
!.env.example

# anvil-data
anvil_state.json
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ FROM ghcr.io/foundry-rs/foundry:v1.7.1

WORKDIR /app

COPY . .
COPY --chown=foundry:foundry . .

RUN git config --global --add safe.directory /app

RUN forge build

RUN forge test
23 changes: 21 additions & 2 deletions docker-compose.prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ services:

container_name: ${ANVIL_CONTAINER_NAME}

command:
entrypoint:
- anvil

command:
- --host
- 0.0.0.0
- --port
Expand All @@ -19,9 +21,20 @@ services:
- --mnemonic
- ${ANVIL_MNEMONIC}

# 自动加载/保存区块链状态
- --state
- /var/data/anvil_state.json

# 每 10 秒自动保存一次
- --state-interval
- "10"

ports:
- "${ANVIL_PORT}:8545"

volumes:
- anvil-data:/var/data

healthcheck:
test:
[
Expand All @@ -48,9 +61,15 @@ services:
RPC_URL: ${RPC_URL}
PRIVATE_KEY: ${PRIVATE_KEY}

entrypoint:
- forge

command:
- script
- script/Deploy.s.sol
- --rpc-url
- ${RPC_URL}
- --broadcast
- --broadcast

volumes:
anvil-data:
17 changes: 15 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@ services:
image: ghcr.io/foundry-rs/foundry:v1.7.1
container_name: ${ANVIL_CONTAINER_NAME}

command:
entrypoint:
- anvil

command:
- --host
- 0.0.0.0
- --port
Expand All @@ -18,11 +20,19 @@ services:
- --mnemonic
- ${ANVIL_MNEMONIC}

# 自动加载/保存区块链状态
- --state
- /var/data/anvil_state.json

# 每 10 秒自动保存一次
- --state-interval
- "10"

ports:
- "${ANVIL_PORT}:${ANVIL_PORT}"

volumes:
- anvil-data:/anvil-data
- anvil-data:/var/data

healthcheck:
test:
Expand Down Expand Up @@ -52,6 +62,9 @@ services:
RPC_URL: ${RPC_URL}
PRIVATE_KEY: ${PRIVATE_KEY}

entrypoint:
- forge

command:
- script
- script/Deploy.s.sol
Expand Down
Loading