This document explains how to use the Docker Compose setup for the xORCA project.
- Docker Desktop for Mac
- Docker Compose
This Docker setup is optimized for macOS with the following features:
- Delegated volume mounting: Uses
:delegatedflag for better performance on macOS - Platform specification: Explicitly sets
platform: linux/amd64for compatibility - Memory limits: Configures appropriate memory limits for the Solana validator
- Resource management: Optimized for Docker Desktop on macOS
The Docker Compose configuration supports several profiles for different use cases:
Starts a local Solana test validator with the xORCA program deployed and builds the JS client.
docker compose --profile dev upThis will:
- Build the Solana program
- Start a local Solana test validator with the xORCA program deployed
- Start program logs
- Build the JS client
Runs all tests for both Rust and JavaScript components.
docker compose --profile test upThis will:
- Build the Solana program
- Run Rust tests
- Run JavaScript tests
Builds all components for production.
docker compose --profile build upThis will:
- Build the Solana program
- Build the JS client
- Build the Rust client
- Generate IDL files
Publishes packages to npm and crates.io.
docker compose --profile publish upNote: Requires NPM_TOKEN and CARGO_TOKEN environment variables to be set.
For publishing, you need to set the following environment variables:
NPM_TOKEN: Your npm authentication tokenCARGO_TOKEN: Your crates.io authentication token
- build-solana-program: Builds the xORCA Solana program
- solana-program-validator: Runs a local Solana test validator
- solana-program-logs: Shows program logs
- build-js: Builds the JavaScript client
- build-rust: Builds the Rust client
- build-idl: Generates IDL files
- test-rust: Runs Rust tests
- test-js: Runs JavaScript tests
- publish-js: Publishes the JS client to npm
- publish-rust: Publishes the Rust client to crates.io
The Solana test validator exposes the following ports:
1024: Gossip1027: TPU8899: RPC8900: WebSocket
xorca_cargo_home: Cached Cargo dependencies
# Start all dev services
docker compose --profile dev up
# Start in detached mode
docker compose --profile dev up -d
# View logs
docker compose --profile dev logs -f# Run all tests
docker compose --profile test up
# Run tests and exit
docker compose --profile test up --abort-on-container-exit# Build all components
docker compose --profile build up# Stop all services
docker compose down
# Remove volumes
docker compose down -v
# Remove all containers and images
docker compose down --rmi all --volumes --remove-orphans- Ensure Docker Desktop has sufficient memory allocated (recommended: 8GB+)
- Use the delegated volume mounting for better I/O performance
- Consider using Docker Desktop's "Use the new Virtualization framework" option for better performance on Apple Silicon Macs
- If you encounter permission issues, ensure Docker Desktop has access to the project directory
- For Apple Silicon Macs, the setup uses
linux/amd64platform for maximum compatibility - If builds are slow, consider increasing Docker Desktop's CPU and memory allocation
- Port conflicts: Make sure ports 8899, 8900, 1024, and 1027 are not in use
- Permission issues: Ensure Docker Desktop has proper permissions to access the project directory
- Build failures: Check that all dependencies are properly installed and the project structure is correct
- Memory issues: Increase Docker Desktop memory allocation if the Solana validator fails to start
- Use
docker compose logs <service-name>to view logs for a specific service - Use
docker compose psto check service status - Use
docker compose exec <service-name> <command>to run commands in a running container