Skip to main content
Kit provides commands to generate Docker configuration files for both local development and production deployment.

docker:init

Generate a production-ready, multi-stage Dockerfile optimized for Rust applications.

What It Creates

Dockerfile Features

The generated Dockerfile uses a multi-stage build for optimal image size:
  1. Stage 1: Frontend Build - Builds the frontend assets using Node.js
  2. Stage 2: Backend Build - Compiles the Rust application with release optimizations
  3. Stage 3: Runtime - Minimal Debian-based image with only runtime dependencies

Building and Running

After generating the Dockerfile:
Create a .env.production file with your production environment variables. Never commit this file to version control.

docker:compose

Generate a docker-compose.yml file for local development with common services.

Options

Default Services

PostgreSQL and Redis are always included:

Optional Services

When prompted (or using flags), you can add:

Examples

Generated Configuration

The generated docker-compose.yml includes:
  • Environment variable defaults - Uses ${VAR:-default} syntax for easy customization
  • Health checks - All services include health checks for reliability
  • Persistent volumes - Data is preserved between container restarts
  • Custom network - Services communicate on an isolated network

Using the Services

Start all services:
Stop all services:
View logs:

Environment Configuration

Update your .env file to use the Docker services:

Customizing Ports

Override default ports using environment variables:

Service URLs

After starting, access services at:
Mailpit captures all outgoing emails from your application. Access the web UI to view sent emails during development.

Unified Binary Commands

Your Kit application builds to a single binary with multiple commands:
When running in Docker:

Production Deployment

For production deployment:
  1. Generate Dockerfile
  2. Build the image
  3. Run
For detailed deployment guides, see Deployment Overview, Railway, or Digital Ocean.

Summary