version: '3.8'
services:
fastintercom-test:
build:
context: .
dockerfile: Dockerfile
container_name: fastintercom-compose-test
restart: "no" # Don't auto-restart during testing
environment:
# Required for API integration
- INTERCOM_ACCESS_TOKEN=${INTERCOM_ACCESS_TOKEN}
# Test configuration - more verbose logging for testing
- FASTINTERCOM_LOG_LEVEL=${FASTINTERCOM_LOG_LEVEL:-DEBUG}
- FASTINTERCOM_INITIAL_SYNC_DAYS=${FASTINTERCOM_INITIAL_SYNC_DAYS:-7}
- FASTINTERCOM_MAX_SYNC_AGE_MINUTES=${FASTINTERCOM_MAX_SYNC_AGE_MINUTES:-5}
- FASTINTERCOM_BACKGROUND_SYNC_INTERVAL=${FASTINTERCOM_BACKGROUND_SYNC_INTERVAL:-10}
# Container paths - use test volumes
- FASTINTERCOM_DB_PATH=/data/fastintercom.db
- FASTINTERCOM_CONFIG_PATH=/config/config.json
- FASTINTERCOM_DATA_DIR=/data
ports:
# Use different port to avoid conflicts with running services
- "${COMPOSE_TEST_PORT:-8002}:8000"
volumes:
# Test-specific persistent volumes
- test-data:/data
- test-config:/config
- test-logs:/var/log/fastintercom
# For development testing - uncomment to mount source
# - .:/app:ro
healthcheck:
test: ["CMD", "python", "-m", "fast_intercom_mcp.cli", "status"]
interval: 10s
timeout: 5s
retries: 3
start_period: 30s
# Resource limits for testing
deploy:
resources:
limits:
memory: 512M
cpus: '1.0'
reservations:
memory: 256M
cpus: '0.5'
# Security settings
security_opt:
- no-new-privileges:true
# Read-only root filesystem (except for required write directories)
read_only: true
tmpfs:
- /tmp:noexec,nosuid,size=100m
# Additional test labels for identification
labels:
- "fastintercom.test=true"
- "fastintercom.version=test"
# Additional test service to verify networking
test-client:
image: curlimages/curl:latest
container_name: fastintercom-test-client
depends_on:
- fastintercom-test
command: >
sh -c "
echo 'Waiting for FastIntercom service...' &&
sleep 30 &&
echo 'Testing FastIntercom HTTP health endpoint...' &&
curl -f http://fastintercom-test:8000/health || echo 'HTTP endpoint not available (may be stdio-only)' &&
echo 'Network test completed'
"
networks:
- default
volumes:
# Test-specific volumes with explicit configuration
test-data:
driver: local
name: fastintercom-test-data
labels:
- "fastintercom.test=true"
test-config:
driver: local
name: fastintercom-test-config
labels:
- "fastintercom.test=true"
test-logs:
driver: local
name: fastintercom-test-logs
labels:
- "fastintercom.test=true"
networks:
default:
name: fastintercom-test-network
labels:
- "fastintercom.test=true"