Repository navigation
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
114 lines (107 loc) · 4.29 KB
/
Copy pathdocker-compose.yml
File metadata and controls
114 lines (107 loc) · 4.29 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
109
110
111
112
113
114
# docker-compose.yml
#
# Local development environment for the Dongle smart contract.
#
# Services:
# stellar — Stellar standalone node (quickstart image) exposing Soroban RPC
# contract — Dev container for building, testing, and deploying the WASM
#
# Quick start:
# docker compose up -d stellar # start the chain
# docker compose run --rm contract make build # compile the WASM
# docker compose run --rm contract make test # run all tests
#
# See DOCKER_SETUP.md for full usage instructions.
name: dongle-smartcontract
# ── Networks ──────────────────────────────────────────────────────────────────
networks:
dongle-net:
driver: bridge
# ── Volumes ───────────────────────────────────────────────────────────────────
volumes:
stellar-data: # Horizon + Stellar Core data (persisted across restarts)
cargo-registry: # Cargo dependency cache (speeds up rebuilds)
cargo-git: # Cargo git source cache
# ── Services ──────────────────────────────────────────────────────────────────
services:
# ── Stellar standalone node ────────────────────────────────────────────────
stellar:
image: stellar/quickstart:latest
container_name: dongle-stellar-node
command:
- --standalone
- --enable-soroban-rpc
ports:
- "8000:8000" # Horizon HTTP API / Soroban RPC
- "11626:11626" # Stellar Core peer port (optional)
volumes:
- stellar-data:/opt/stellar
networks:
- dongle-net
healthcheck:
test: ["CMD", "curl", "-sf", "http://localhost:8000/"]
interval: 10s
timeout: 5s
retries: 20
start_period: 30s
restart: unless-stopped
# ── Contract dev container ─────────────────────────────────────────────────
#
# Mount the repo source so edits on the host are immediately visible.
# Use `docker compose run --rm contract <cmd>` to run one-off commands.
contract:
build:
context: .
dockerfile: Dockerfile
target: runtime
container_name: dongle-contract-dev
depends_on:
stellar:
condition: service_healthy
environment:
# Stellar CLI network configuration
- SOROBAN_RPC_URL=http://stellar:8000/soroban/rpc
- STELLAR_NETWORK_PASSPHRASE=Standalone Network ; February 2017
# Cargo cache paths
- CARGO_HOME=/usr/local/cargo
- CARGO_TARGET_DIR=/app/target
volumes:
# Live-mount source code
- .:/app
# Persist Cargo registry/git caches across container restarts
- cargo-registry:/usr/local/cargo/registry
- cargo-git:/usr/local/cargo/git
networks:
- dongle-net
working_dir: /app/dongle-smartcontract
# Keep the container alive; exec or run commands against it
command: >
bash -c "echo 'Dongle dev container ready.
Run: docker compose exec contract make build
docker compose exec contract make test' && tail -f /dev/null"
restart: unless-stopped
# ── One-shot test runner (useful in CI) ───────────────────────────────────
#
# docker compose --profile test run --rm test
test:
build:
context: .
dockerfile: Dockerfile
target: runtime
depends_on:
stellar:
condition: service_healthy
environment:
- SOROBAN_RPC_URL=http://stellar:8000/soroban/rpc
- STELLAR_NETWORK_PASSPHRASE=Standalone Network ; February 2017
- CARGO_HOME=/usr/local/cargo
volumes:
- .:/app
- cargo-registry:/usr/local/cargo/registry
- cargo-git:/usr/local/cargo/git
networks:
- dongle-net
working_dir: /app/dongle-smartcontract
command: ["cargo", "test"]
profiles:
- test