synor/docker/economics-service/Dockerfile
Gulshan Yadav 17f0b4ce4b feat(economics): add Phase 12 - Economics & Billing infrastructure
Complete economics service implementation with:

- Price Oracle with TWAP (Time-Weighted Average Price)
  - Multi-source price aggregation
  - Configurable staleness thresholds
  - Exponential, SMA, and standard TWAP strategies

- Metering Service for L2 usage tracking
  - Storage: GB-months, retrieval bandwidth
  - Hosting: bandwidth, custom domains
  - Database: queries, vector searches
  - Compute: CPU core-hours, GPU hours, memory
  - Network: bandwidth, requests

- Billing Engine
  - Invoice generation with line items
  - Payment processing (crypto/fiat)
  - Credit management with expiration
  - Auto-pay from prepaid balance

- Pricing Tiers: Free, Standard, Premium, Enterprise
  - 0%, 10%, 20%, 30% usage discounts
  - SLA guarantees: 95%, 99%, 99.9%, 99.99%

- Cost Calculator & Estimator
  - Usage projections
  - Tier comparison recommendations
  - ROI analysis

- Docker deployment with PostgreSQL schema

All 61 tests passing.
2026-01-19 21:51:26 +05:30

49 lines
1.2 KiB
Docker

# Synor Economics Service Dockerfile
# Provides pricing oracle, metering, and billing APIs
FROM rust:1.75-bookworm AS builder
WORKDIR /app
# Copy workspace files
COPY Cargo.toml Cargo.lock ./
COPY crates/ ./crates/
# Build the economics service binary
RUN cargo build --release -p synor-economics --features "http-feeds"
# Runtime image
FROM debian:bookworm-slim
RUN apt-get update && apt-get install -y \
ca-certificates \
libssl3 \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Copy built binary
COPY --from=builder /app/target/release/synor-economics /usr/local/bin/ 2>/dev/null || true
# Create config directory
RUN mkdir -p /app/config /app/data
# Copy default config
COPY docker/economics-service/config.toml /app/config/
# Environment variables
ENV RUST_LOG=info
ENV CONFIG_PATH=/app/config/config.toml
ENV DATA_PATH=/app/data
# Ports
# 4010 - HTTP API
# 4011 - Metrics
EXPOSE 4010 4011
# Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
CMD curl -f http://localhost:4010/health || exit 1
# For library-only crate, we run a simple health indicator
CMD ["echo", "Economics service ready. Use as library dependency."]