Docker & Helm

Run aimock as a container in Docker or deploy it to Kubernetes with the included Helm chart. The image is based on node:22-alpine with zero runtime dependencies.

Docker

Build the image

Build shell
docker build -t aimock .

Run with local fixtures

Run shell
$ npx aimock --fixtures ./fixtures

# Custom port
$ npx aimock --fixtures ./fixtures --port 5555
Run shell
# Mount your fixture directory into the container
$ docker run -p 4010:4010 \
  -v ./fixtures:/fixtures \
  ghcr.io/copilotkit/aimock

# Custom port
$ docker run -p 5555:5555 \
  -v ./fixtures:/fixtures \
  ghcr.io/copilotkit/aimock \
  npx aimock --fixtures /fixtures --port 5555

# Pull from GitHub Container Registry
$ docker pull ghcr.io/copilotkit/aimock:latest
$ docker run -p 4010:4010 \
  -v ./fixtures:/fixtures \
  ghcr.io/copilotkit/aimock

Dockerfile

The multi-stage Dockerfile builds the TypeScript source and copies only the compiled output:

Dockerfile docker
# --- Build stage ---
FROM node:22-alpine AS build
RUN corepack enable && corepack prepare [email protected] --activate
WORKDIR /app
COPY package.json pnpm-lock.yaml ./
RUN pnpm install --frozen-lockfile
COPY tsconfig.json tsdown.config.ts ./
COPY src/ src/
RUN pnpm run build

# --- Production stage ---
FROM node:22-alpine
WORKDIR /app
COPY --from=build /app/dist/ dist/
COPY fixtures/ fixtures/
EXPOSE 4010
ENTRYPOINT ["node", "dist/cli.js"]
CMD ["--fixtures", "/fixtures", "--host", "0.0.0.0"]

Helm Chart

Deploy to Kubernetes using the Helm chart in charts/aimock/.

Install

Helm install shell
helm install aimock ./charts/aimock

# With custom values
helm install aimock ./charts/aimock \
  --set image.tag=1.4.0 \
  --set service.port=5555 \
  --set replicaCount=2

Configuration (values.yaml)

charts/aimock/values.yaml yaml
replicaCount: 1

image:
  repository: ghcr.io/copilotkit/aimock
  tag: ""            # defaults to Chart appVersion
  pullPolicy: IfNotPresent

service:
  type: ClusterIP
  port: 4010

fixtures:
  mountPath: /app/fixtures
  existingClaim: ""  # Use a PVC for fixture files

resources: {}
  # limits:
  #   cpu: 200m
  #   memory: 256Mi

Fixture Loading

To load custom fixtures in Kubernetes, create a PersistentVolumeClaim with your fixture JSON files and set fixtures.existingClaim in your values. The chart mounts the PVC at fixtures.mountPath (default /app/fixtures).

Health Checks

The deployment includes liveness and readiness probes using httpGet on /health (liveness, starts after 5 seconds) and /ready (readiness, starts after 2 seconds).

v1.6.0 Features

The Docker image supports all v1.6.0 features out of the box: