Docker
mik is available as a minimal Docker image (~49MB) for containerized deployments.
Quick Start
Section titled “Quick Start”# Pull the imagedocker pull ghcr.io/dufeutech/mik
# Run with volume mountdocker run -v $(pwd):/app -p 3000:3000 ghcr.io/dufeutech/mikProject Structure
Section titled “Project Structure”Mount your project directory to /app:
my-project/├── mik.toml # Configuration├── modules/ # WASM handlers│ ├── api.wasm│ └── auth.wasm└── scripts/ # Optional: JS orchestration └── router.jsDocker Compose
Section titled “Docker Compose”Basic Setup
Section titled “Basic Setup”services: mik: image: ghcr.io/dufeutech/mik:latest ports: - "3000:3000" volumes: - ./:/app environment: - RUST_LOG=infoWith OpenTelemetry
Section titled “With OpenTelemetry”services: mik: image: ghcr.io/dufeutech/mik:latest ports: - "3000:3000" volumes: - ./:/app environment: - RUST_LOG=info
jaeger: image: jaegertracing/all-in-one:latest ports: - "16686:16686" # UI - "4317:4317" # OTLP gRPCWith mik.toml:
[project]name = "my-service"
[server]port = 3000modules = "modules/"
[tracing]enabled = trueotlp_endpoint = "http://jaeger:4317"Production Setup
Section titled “Production Setup”services: mik: image: ghcr.io/dufeutech/mik:latest ports: - "3000:3000" volumes: - ./modules:/app/modules:ro - ./mik.toml:/app/mik.toml:ro environment: - RUST_LOG=info deploy: resources: limits: memory: 512M reservations: memory: 128M healthcheck: test: ["CMD", "/mik", "run", "--help"] interval: 30s timeout: 10s retries: 3 restart: unless-stoppedWith Reverse Proxy (Caddy)
Section titled “With Reverse Proxy (Caddy)”services: caddy: image: caddy:alpine ports: - "80:80" - "443:443" volumes: - ./Caddyfile:/etc/caddy/Caddyfile - caddy_data:/data depends_on: - mik
mik: image: ghcr.io/dufeutech/mik:latest volumes: - ./:/app expose: - "3000"
volumes: caddy_data:With Caddyfile:
example.com { reverse_proxy mik:3000}Environment Variables
Section titled “Environment Variables”| Variable | Default | Description |
|---|---|---|
PORT | 3000 | Server port |
RUST_LOG | info | Log level (debug, info, warn, error) |
HOST | 0.0.0.0 | Bind address |
Image Details
Section titled “Image Details”The Docker image:
- Base:
scratch(minimal, no shell) - Size: ~49MB
- TLS: rustls (pure Rust, no OpenSSL)
- Features: Full runtime + OTLP tracing
- Disabled: Registry features (use volume mounts instead)
Building Custom Image
Section titled “Building Custom Image”To include your modules in the image:
FROM ghcr.io/dufeutech/mik:latest
COPY mik.toml /app/mik.tomlCOPY modules/ /app/modules/Build and run:
docker build -t my-service .docker run -p 3000:3000 my-serviceHealth Checks
Section titled “Health Checks”The /health endpoint returns service status:
curl http://localhost:3000/health{ "status": "ready", "cache_size": 2, "cache_capacity": 100}Troubleshooting
Section titled “Troubleshooting”Container exits immediately
Section titled “Container exits immediately”Check that mik.toml exists and modules/ contains .wasm files:
docker run --rm -v $(pwd):/app --entrypoint="" ghcr.io/dufeutech/mik:latest /mik runModule not found
Section titled “Module not found”Ensure the module path in requests matches the filename:
modules/api.wasm→/run/api/*modules/auth.wasm→/run/auth/*
Permission denied
Section titled “Permission denied”On Linux, ensure mounted files are readable:
chmod -R 644 modules/*.wasmchmod 644 mik.toml