-
Notifications
You must be signed in to change notification settings - Fork 127
/
docker-compose.yml
132 lines (124 loc) · 4 KB
/
docker-compose.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
x-build-defaults: &build-defaults
build:
dockerfile: Dockerfile.foundry
context: .
networks:
- contracts_subnet
x-anvil-defaults: &anvil-defaults
<<: *build-defaults
restart: on-failure
healthcheck:
test: ['CMD', '/usr/bin/nc', '-z', 'localhost', '${PORT:-8545}']
interval: 1s
timeout: 1s
retries: 3
x-deployer-defaults: &deployer-defaults
<<: *build-defaults
environment:
- DEPLOYER
volumes:
- .:/app
working_dir: /app
services:
l2-anvil:
<<: *anvil-defaults
command: |
sh -c '
exec anvil --host 0.0.0.0 --port ${PORT:-8545} --rpc-url $$L2_MAINNET_RPC_URL --state /var/lib/anvil/state --retries 3 --timeout 10000
'
environment:
- L2_MAINNET_RPC_URL
volumes:
- l2-anvil-data:/var/lib/anvil
- l2-anvil-cache:/root/.foundry/cache
ports:
- '${PORT:-8545}:${PORT:-8545}'
l2-deployer:
<<: *deployer-defaults
depends_on:
- l2-anvil
environment:
- DEPLOYER
- ID_REGISTRY_OWNER_ADDRESS
- KEY_REGISTRY_OWNER_ADDRESS
- BUNDLER_OWNER_ADDRESS
- RECOVERY_PROXY_OWNER_ADDRESS
- STORAGE_RENT_PRICE_FEED_ADDRESS
- STORAGE_RENT_UPTIME_FEED_ADDRESS
- STORAGE_RENT_VAULT_ADDRESS
- STORAGE_RENT_ROLE_ADMIN_ADDRESS
- STORAGE_RENT_ADMIN_ADDRESS
- STORAGE_RENT_OPERATOR_ADDRESS
- STORAGE_RENT_TREASURER_ADDRESS
- BUNDLER_TRUSTED_CALLER_ADDRESS
- METADATA_VALIDATOR_OWNER_ADDRESS
- MIGRATOR_ADDRESS
entrypoint: |
sh -c '
set -e
git config --global --add safe.directory "*"
export RPC_URL="http://l2-anvil:${PORT:-8545}"
echo "Waiting for Anvil..."
while ! nc -z l2-anvil "${PORT:-8545}"; do sleep 0.1; done
echo "Anvil online"
echo "Enabling impersonation"
cast rpc anvil_autoImpersonateAccount true --rpc-url "$$RPC_URL" > /dev/null
echo "Funding deployer"
cast rpc anvil_setBalance "$$DEPLOYER" 0xde0b6b3a7640000000 --rpc-url "$$RPC_URL" > /dev/null
echo "Deploying contract"
forge install
forge script -v script/DeployL2.s.sol --rpc-url "$$RPC_URL" --unlocked --broadcast --sender "$$DEPLOYER"
echo "Disabling impersonation"
cast rpc anvil_autoImpersonateAccount false --rpc-url "$$RPC_URL" > /dev/null
echo "Deploy complete"
'
l1-anvil:
<<: *anvil-defaults
command: |
sh -c '
exec anvil --host 0.0.0.0 --port ${PORT:-8545} --rpc-url $$L1_MAINNET_RPC_URL --state /var/lib/anvil/state --retries 3 --timeout 10000
'
environment:
- L1_MAINNET_RPC_URL
volumes:
- l1-anvil-data:/var/lib/anvil
- l1-anvil-cache:/root/.foundry/cache
ports:
- '${PORT:-8546}:${PORT:-8545}'
l1-deployer:
<<: *deployer-defaults
depends_on:
- l1-anvil
environment:
- DEPLOYER
- FNAME_RESOLVER_SERVER_URL
- FNAME_RESOLVER_SIGNER_ADDRESS
- FNAME_RESOLVER_OWNER_ADDRESS
entrypoint: |
sh -c '
set -e
git config --global --add safe.directory "*"
export RPC_URL="http://l1-anvil:${PORT:-8545}"
echo "Waiting for Anvil..."
while ! nc -z l1-anvil "${PORT:-8545}"; do sleep 0.1; done
echo "Anvil online"
echo "Enabling impersonation"
cast rpc anvil_autoImpersonateAccount true --rpc-url "$$RPC_URL" > /dev/null
echo "Funding deployer"
cast rpc anvil_setBalance "$$DEPLOYER" 0xde0b6b3a7640000 --rpc-url "$$RPC_URL" > /dev/null
echo "Deploying contract"
forge install
forge script -v script/DeployL1.s.sol --rpc-url "$$RPC_URL" --unlocked --broadcast --sender "$$DEPLOYER"
echo "Disabling impersonation"
cast rpc anvil_autoImpersonateAccount false --rpc-url "$$RPC_URL" > /dev/null
echo "Deploy complete"
'
volumes:
l1-anvil-cache:
l1-anvil-data:
l2-anvil-cache:
l2-anvil-data:
networks:
# Allows us to share the services in this file with other Docker Compose files
contracts_subnet:
driver: bridge