# Docker Deployment Guide ## Building the Image ```bash # Build latest version docker build . -t imexonline/media-server:latest -t imexonline/media-server:1.0 # Build beta version docker build . -t imexonline/media-server:beta ``` ## Docker Image Features The Docker image includes: - Node.js 22 Alpine base - AWS CLI v2 for S3 sync functionality - GraphicsMagick, ImageMagick, and FFmpeg for media processing - Redis for background job processing - PM2 for process management - PST timezone configuration for scheduled tasks ## Environment Variables ### Required - `MEDIA_PATH` - Path to media storage directory - `IMS_TOKEN` - Authentication token ### Optional - `DUPLICATE_BILL_TO_VENDOR` - Whether to duplicate bills to vendor directory - `CONVERT_QUALITY` - Image conversion quality (0.0-1.0) - `KEEP_CONVERTED_ORIGINALS` - Whether to keep original files after conversion ### S3 Sync (Optional) - `S3_BUCKET_NAME` - S3 bucket name for daily sync - `S3_REGION` - AWS region (default: us-east-1) - `S3_ACCESS_KEY_ID` - AWS access key - `S3_SECRET_ACCESS_KEY` - AWS secret key - `S3_KEY_PREFIX` - S3 key prefix (default: jobs/) ## Running with Docker Compose 1. Update `docker-compose.yml` with your configuration 2. Uncomment and configure S3 environment variables if needed 3. Run: `docker-compose up -d` ## Manual Docker Run ```bash docker run -d \ --name bodyshop-media-server \ -p 8000:8000 \ -v "/path/to/media:/media" \ -e MEDIA_PATH=/media \ -e IMS_TOKEN=your-token \ -e S3_BUCKET_NAME=your-bucket \ -e S3_ACCESS_KEY_ID=your-key \ -e S3_SECRET_ACCESS_KEY=your-secret \ imexonline/media-server:latest ``` ## S3 Sync in Docker The S3 sync functionality works automatically in Docker: - AWS CLI v2 is pre-installed - Timezone is set to PST for midnight scheduling - Daily sync runs at midnight PST automatically - Check sync status via API: `GET /s3-sync/status` ## Health Checks - Main health check: `GET /health` - Application status: `GET /` (requires token) - S3 sync status: `GET /s3-sync/status` (requires token) ## Logs View container logs: `docker logs bodyshop-media-server` The application uses structured logging with daily rotation.