-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
99 lines (98 loc) · 2.84 KB
/
docker-compose.yml
File metadata and controls
99 lines (98 loc) · 2.84 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
services:
db:
restart: always
container_name: agrichain_db
image: postgres:13.21-alpine3.21
environment:
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=postgres
- POSTGRES_DB=agrichain
ports:
- 5433:5432
volumes:
- postgres_data:/var/lib/postgresql/data
- ./database/commands/:/docker-entrypoint-initdb.d/
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 5s
timeout: 5s
retries: 5
frontend:
container_name: agrichain_frontend
volumes:
- ./frontend:/home/node
build:
context: ./frontend
environment:
# URLs
- REACT_APP_API_URL=http://localhost:5000
- REACT_APP_ENV=development
# Smart contract
- VITE_CONTRACT_ADDRESS=0x5FbDB2315678afecb367f032d93F642f64180aa3
- VITE_BLOCKCHAIN_PROVIDER_URL=http://contract:8545
# when using nginx + Docker, vite proxy false
- PROXY=false
working_dir: /home/node
backend:
container_name: agrichain_backend
build:
context: ./backend
volumes:
- ./backend/:/backend
- /backend/node_modules
environment:
# Application
- PORT=5000
- NODE_ENV=development
# Database
- DB_USER=postgres
- DB_HOST=agrichain_db
- DB_NAME=agrichain
- DB_PASSWORD=postgres
- DB_PORT=5432
# Session
- SESSION_SECRET=MySuperSecretSessionSecret1@!11
- SESSION_MAX_AGE=86400000
# CORS
- CORS_ORIGIN=http://localhost:5173/
# Smart contract
- CONTRACT_ADDRESS=0x5FbDB2315678afecb367f032d93F642f64180aa3
- BLOCKCHAIN_PROVIDER_URL=http://contract:8545
# This is private key #0 from Hardhat's provided accounts.
# Those keys are PUBLIC. See https://hardhat.org/hardhat-network/docs/overview
- ADMIN_PRIVATE_KEY=0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80
working_dir: /backend
depends_on:
db:
condition: service_healthy
ports:
- 5000:5000
contract:
container_name: agrichain_contract
build:
context: ./smartcontract
volumes:
- ./smartcontract/:/smartcontract
- /smartcontract/node_modules
working_dir: /smartcontract
ports:
- 8545:8545
deploy:
container_name: agrichain_deploy
build:
context: ./smartcontract
depends_on:
- contract
command: ["npx", "hardhat", "run", "scripts/deploy.js"]
nginx:
container_name: agrichain_nginx
build:
context: ./nginx
volumes:
- ./nginx/nginx-proxy.conf:/etc/nginx/conf.d/default.conf:ro
depends_on:
- backend
ports:
- 5173:8080
volumes:
postgres_data: