Documentation

docs
deployment
docker

Docker

Docker Deployment

Mithril ships a multi-stage Alpine Dockerfile and docker-compose services for development.

Build Image#

make docker-build
# or: docker build -t mithril:latest .

Run Container#

make run-docker
# Maps host :4000 -> container :4000

Pass environment at runtime:

docker run --rm -p 4000:4000 \
  -e JWT_SECRET=change-me \
  -e DATABASE_URL=postgres://user:pass@host.docker.internal:5432/mithril_rev?sslmode=disable \
  mithril:latest

Dockerfile Overview#

  1. Builder stage: golang:1.25-alpine, go build -o app .
  2. Runtime stage: alpine, copies binary + views/, public/, docs/swagger.json
  3. Healthcheck: GET /health

Dev Services (Compose)#

infrastructure/docker-compose.services.yml provides:

ServicePortCommand
postgres5432make dc-up-postgres
pgadmin5051make dc-up-pgadmin
adminer8080make dc-up-adminer
embedded DBMS5050mithril dbms (app command, not compose)
redis6379make dc-up-redis
rabbitmq5672make dc-up-rabbitmq
kafka9092make dc-up-kafka
make dc-up-postgres
make dc-logs-postgres
make dc-stop-postgres

Postgres default database: mithril_rev.

Production Notes#

  • Set APP_ENV=production and a strong JWT_SECRET
  • Use external managed PostgreSQL
  • Mount secrets via orchestrator (K8s secrets, not .env in image)
  • Enable ENABLE_HELMET=true and ENABLE_COMPRESSION=true as needed

Next Steps#