Skip to content

Latest commit

 

History

History
73 lines (52 loc) · 1.75 KB

File metadata and controls

73 lines (52 loc) · 1.75 KB

MockDraft Docker Usage

Building the Image

docker build -t mockdraft:latest .

Running the Container

Basic Usage

docker run -p 3000:3000 -v $(pwd)/openapi.yaml:/app/specs/openapi.yaml mockdraft:latest

With Custom Arguments

# Enable delay
docker run -p 3000:3000 -v $(pwd)/openapi.yaml:/app/specs/openapi.yaml mockdraft:latest start /app/specs/openapi.yaml -p 3000 --delay

# Enable chaos mode
docker run -p 3000:3000 -v $(pwd)/openapi.yaml:/app/specs/openapi.yaml mockdraft:latest start /app/specs/openapi.yaml -p 3000 --chaos

# Enable both
docker run -p 3000:3000 -v $(pwd)/openapi.yaml:/app/specs/openapi.yaml mockdraft:latest start /app/specs/openapi.yaml -p 3000 --delay --chaos

# Custom port
docker run -p 4000:4000 -v $(pwd)/openapi.yaml:/app/specs/openapi.yaml mockdraft:latest start /app/specs/openapi.yaml -p 4000

Using Docker Compose

Start the service

docker-compose up

Start with rebuild

docker-compose up --build

Run in background

docker-compose up -d

Stop the service

docker-compose down

Enable features

Edit docker-compose.yml and uncomment the command line with --delay and --chaos flags.

Multi-stage Build

The Dockerfile uses a multi-stage build to:

  1. Builder stage: Installs all dependencies and compiles TypeScript
  2. Production stage: Only includes production dependencies and compiled code

This results in a smaller final image (~150MB instead of ~300MB).

Volume Mounting

Mount your OpenAPI specs to /app/specs/:

docker run -v $(pwd)/my-api.yaml:/app/specs/openapi.yaml mockdraft:latest

Environment Variables

None required currently. The tool is fully configured via command-line arguments.