-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathdocker-compose.ci.yml
More file actions
109 lines (104 loc) · 3.63 KB
/
Copy pathdocker-compose.ci.yml
File metadata and controls
109 lines (104 loc) · 3.63 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
104
105
106
107
108
services:
postgres:
image: postgres:14-alpine
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: multisig
volumes:
- postgres-ci-data:/var/lib/postgresql/data
- ./docker/init-db.sh:/docker-entrypoint-initdb.d/init-db.sh:ro
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 5s
timeout: 5s
retries: 20
networks:
- multisig-ci-network
app:
build:
context: .
dockerfile: Dockerfile.ci
target: app
environment:
NODE_ENV: test
NEXT_TELEMETRY_DISABLED: "1"
SKIP_ENV_VALIDATION: "true"
DATABASE_URL: postgresql://postgres:postgres@postgres:5432/multisig
DIRECT_URL: postgresql://postgres:postgres@postgres:5432/multisig
JWT_SECRET: ${CI_JWT_SECRET}
NEXT_PUBLIC_BLOCKFROST_API_KEY_PREPROD: ${CI_BLOCKFROST_PREPROD_API_KEY:-}
NEXT_PUBLIC_BLOCKFROST_API_KEY_MAINNET: ${CI_BLOCKFROST_MAINNET_API_KEY:-}
BLOCKFROST_API_KEY_PREPROD: ${CI_BLOCKFROST_PREPROD_API_KEY:-}
depends_on:
postgres:
condition: service_healthy
networks:
- multisig-ci-network
command: >
sh -c "
echo 'Waiting for PostgreSQL to be ready...' &&
until pg_isready -h postgres -p 5432 -U postgres; do sleep 1; done &&
echo 'Running Prisma migrations...' &&
npx prisma migrate deploy || npx prisma db push &&
echo 'Starting application (production build)...' &&
node_modules/.bin/next start --hostname 0.0.0.0 --port 3000
"
healthcheck:
test:
- CMD-SHELL
- node -e "fetch('http://localhost:3000/api/swagger').then((r)=>process.exit(r.ok?0:1)).catch(()=>process.exit(1))"
interval: 5s
timeout: 5s
retries: 30
ci-runner:
build:
context: .
dockerfile: Dockerfile.ci
target: base
environment:
NODE_ENV: test
NEXT_TELEMETRY_DISABLED: "1"
SKIP_ENV_VALIDATION: "true"
DATABASE_URL: postgresql://postgres:postgres@postgres:5432/multisig
DIRECT_URL: postgresql://postgres:postgres@postgres:5432/multisig
API_BASE_URL: http://app:3000
CI_NETWORK_ID: ${CI_NETWORK_ID:-0}
CI_NUM_REQUIRED_SIGNERS: ${CI_NUM_REQUIRED_SIGNERS:-2}
CI_JWT_SECRET: ${CI_JWT_SECRET}
CI_MNEMONIC_1: ${CI_MNEMONIC_1:-}
CI_MNEMONIC_2: ${CI_MNEMONIC_2:-}
CI_MNEMONIC_3: ${CI_MNEMONIC_3:-}
CI_BLOCKFROST_PREPROD_API_KEY: ${CI_BLOCKFROST_PREPROD_API_KEY:-}
CI_WALLET_TYPES: ${CI_WALLET_TYPES:-legacy,hierarchical,sdk}
CI_SIGN_WALLET_TYPE: ${CI_SIGN_WALLET_TYPE:-legacy}
SIGN_BROADCAST: ${SIGN_BROADCAST:-true}
CI_ROUTE_SCENARIOS: ${CI_ROUTE_SCENARIOS:-}
CI_ROUTE_CHAIN_REPORT_PATH: ${CI_ROUTE_CHAIN_REPORT_PATH:-/artifacts/ci-route-chain-report.md}
CI_CONTEXT_PATH: ${CI_CONTEXT_PATH:-/tmp/ci-wallet-context.json}
CI_DREP_ANCHOR_URL: ${CI_DREP_ANCHOR_URL:-}
CI_DREP_ANCHOR_JSON: ${CI_DREP_ANCHOR_JSON:-}
CI_STAKE_POOL_ID_HEX: ${CI_STAKE_POOL_ID_HEX:-}
depends_on:
app:
condition: service_healthy
networks:
- multisig-ci-network
volumes:
- ./ci-artifacts:/artifacts
profiles:
- ci-test
command: >
sh -c "
status=0;
node .ci-dist/bootstrap.mjs || status=$$?;
if [ \"$$status\" -eq 0 ]; then node .ci-dist/wallet-status.mjs || status=$$?; fi;
if [ \"$$status\" -eq 0 ]; then node .ci-dist/route-chain.mjs || status=$$?; fi;
rm -f \"${CI_CONTEXT_PATH:-/tmp/ci-wallet-context.json}\";
exit \"$$status\"
"
volumes:
postgres-ci-data:
networks:
multisig-ci-network:
driver: bridge