Quick Start
Using Docker Compose (Recommended)
Using Docker Directly
Available Docker Images
The Dockerfile uses multi-stage builds to create optimized images for different use cases:| Target | Image Tag | Purpose | Size |
|---|---|---|---|
runtime | myspellchecker:latest | Production API server | ~200MB |
development | myspellchecker:dev | Development with hot reload + tests | ~350MB |
cli | myspellchecker:cli | CLI-only (no web server) | ~150MB |
Building Specific Targets
Docker Compose Services
Production API (api)
- Port: 8000
- Health check:
http://localhost:8000/health - Resource limits: 2 CPUs, 1GB memory
- Restart policy:
unless-stopped
Development Server (dev)
- Port: 8000
- Hot reload: Enabled (watches
/app/src) - Log level: DEBUG
- Profile:
dev(requires--profile dev)
GPU-Enabled API (api-gpu)
For transformer-based POS tagging and AI features:
- Requires: NVIDIA GPU with Docker GPU support
- Resource limits: 4 CPUs, 4GB memory, 1 GPU
- Environment:
CUDA_VISIBLE_DEVICES=0
CLI Tool (cli)
Test Runner (test)
Volume Mounts
| Host Path | Container Path | Purpose |
|---|---|---|
./data | /app/data | Dictionary database files |
./config | /app/config | Custom configuration |
./input | /app/input | Input files for CLI |
./output | /app/output | Output files from CLI |
./src | /app/src | Source code (dev only) |
Example: Using Custom Dictionary
Environment Variables
| Variable | Default | Description |
|---|---|---|
PYTHONPATH | /app/src | Python module path |
LOG_LEVEL | INFO | Logging level (DEBUG, INFO, WARNING, ERROR) |
CUDA_VISIBLE_DEVICES | 0 | GPU device ID (gpu service only) |
Custom Environment
Production Deployment
Basic Deployment
With Reverse Proxy (nginx)
Health Monitoring
The API includes a health endpoint:Building Dictionary in Docker
From Corpus File
Sample Dictionary
GPU Support
Prerequisites
- NVIDIA GPU with CUDA support
- NVIDIA Container Toolkit
Installation (Ubuntu)
Running with GPU
Troubleshooting
Container Won’t Start
Database Not Found
Permission Denied
GPU Not Detected
Memory Issues
Security Considerations
The Docker images follow security best practices:- Non-root user: Containers run as
appuser(UID 1000) - Read-only mounts: Data volumes mounted as read-only where possible
- Minimal base image: Uses
python:slimfor smaller attack surface - No secrets in image: Configuration via environment variables or mounted volumes
- Health checks: Automatic container health monitoring
Running with Read-Only Filesystem
See Also
- Installation Guide - pip installation
- Configuration - Configuration options
- Performance Tuning - Optimization strategies
- Integration Guide - Web framework integration