Repository navigation
Expand file tree
/
Copy pathdocker-compose.dev.yml
More file actions
103 lines (98 loc) · 3.2 KB
/
Copy pathdocker-compose.dev.yml
File metadata and controls
103 lines (98 loc) · 3.2 KB
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
services:
mongodb:
image: mongo:7.0
container_name: certchain-dev-mongodb
restart: unless-stopped
ports:
- "27017:27017"
volumes:
- mongodb_dev_data:/data/db
healthcheck:
test: ["CMD", "mongosh", "--quiet", "--eval", "db.adminCommand('ping').ok"]
interval: 5s
timeout: 5s
retries: 20
start_period: 10s
hardhat:
build: ./smart-contract
container_name: certchain-dev-hardhat
restart: unless-stopped
command: ["npx", "hardhat", "node", "--hostname", "0.0.0.0"]
ports:
- "8545:8545"
healthcheck:
test:
[
"CMD-SHELL",
"node -e \"fetch('http://127.0.0.1:8545',{method:'POST',headers:{'content-type':'application/json'},body:JSON.stringify({jsonrpc:'2.0',id:1,method:'eth_chainId',params:[]})}).then(r=>process.exit(r.ok?0:1)).catch(()=>process.exit(1))\"",
]
interval: 3s
timeout: 5s
retries: 30
start_period: 10s
deploy-contract:
build: ./smart-contract
container_name: certchain-dev-deploy
depends_on:
hardhat:
condition: service_healthy
environment:
HARDHAT_RPC_URL: http://hardhat:8545
command: ["npx", "hardhat", "run", "scripts/deploy.js", "--network", "localhost"]
restart: "no"
backend:
image: node:20-alpine
container_name: certchain-dev-backend
working_dir: /app
depends_on:
mongodb:
condition: service_healthy
deploy-contract:
condition: service_completed_successfully
env_file:
- ./backend/.env
environment:
NODE_ENV: development
PORT: 5001
MONGODB_URI: mongodb://mongodb:27017/certchain
ALCHEMY_URL: http://hardhat:8545
CONTRACT_ADDRESS: 0x5FbDB2315678afecb367f032d93F642f64180aa3
PUBLIC_FRONTEND_URL: ${FRONTEND_URL:-http://localhost:3000}
FRONTEND_URL: ${FRONTEND_URL:-http://localhost:3000}
CORS_ALLOWED_ORIGINS: ${CORS_ALLOWED_ORIGINS:-http://localhost:3000,http://127.0.0.1:3000}
command: sh -c "npm ci && npm run dev"
ports:
- "5001:5001"
volumes:
- ./backend:/app
- backend_node_modules:/app/node_modules
- ./backend/uploads:/app/uploads
- ./smart-contract:/smart-contract:ro
frontend:
image: node:20-alpine
container_name: certchain-dev-frontend
working_dir: /app
depends_on:
- backend
env_file:
- ./frontend/.env.local
environment:
NODE_ENV: development
NEXT_PUBLIC_API_URL: ${NEXT_PUBLIC_API_URL:-http://localhost:5001/api}
NEXT_PUBLIC_FRONTEND_URL: ${FRONTEND_URL:-http://localhost:3000}
SERVER_API_URL: http://backend:5001/api
NEXT_PUBLIC_CONTRACT_ADDRESS: 0x5FbDB2315678afecb367f032d93F642f64180aa3
NEXT_PUBLIC_CHAIN_ID: 31337
NEXT_PUBLIC_RPC_URL: ${NEXT_PUBLIC_RPC_URL:-http://localhost:8545}
NEXT_PUBLIC_IPFS_GATEWAY: ${NEXT_PUBLIC_IPFS_GATEWAY:-https://gateway.pinata.cloud/ipfs}
NEXT_PUBLIC_ISSUING_ORG: ${NEXT_PUBLIC_ISSUING_ORG:-CertChain}
command: sh -c "npm ci && npm run dev -- -H 0.0.0.0"
ports:
- "3000:3000"
volumes:
- ./frontend:/app
- frontend_node_modules:/app/node_modules
volumes:
mongodb_dev_data:
backend_node_modules:
frontend_node_modules: