Skip to main content
Voxray ships as a statically linked Go binary that fits cleanly into a minimal Alpine image. The default build produces a WebSocket-only server with no C dependencies. A separate multi-stage build adds Opus/WebRTC support via CGO and a gcc toolchain.

Dockerfile walkthrough

The repository Dockerfile uses a two-stage build: a full Go toolchain for compilation, then a stripped Alpine image for the runtime.
Dockerfile

Builder stage

Runtime stage

Build variants

The default Dockerfile sets CGO_ENABLED=0, which produces a fully static binary but disables Opus codec support. If your pipeline uses WebRTC with Opus audio (e.g. browser-to-server via DTLS/SRTP), you must use the WebRTC variant below. WebSocket-based deployments — including those connecting from Pipecat, LiveKit agents, or Daily — do not require CGO.

WebRTC + Opus Dockerfile

To enable Opus you need CGO, which means a C compiler in the builder stage and musl-compatible shared libs in the runtime image (or static linking via musl-cross).
Dockerfile.webrtc
Build it with:

Building the default image

Docker will pull golang:1.25-alpine on first run, compile the binary, and assemble the runtime layer. Subsequent builds reuse the module cache layer unless go.mod or go.sum changed.

Running the container

Basic run

Mount your config.json from the host. The file is mounted read-only (:ro) so the container cannot modify it.

With environment variable overrides

All config.json fields can be overridden at runtime via environment variables. Provider API keys should always be passed as env vars rather than embedded in the config file.

Detached with automatic restart

Port configuration

The default port is 8080, set via EXPOSE 8080 in the Dockerfile and the default config. Override it in order of precedence:
  1. VOXRAY_PORT environment variable
  2. PORT environment variable
  3. port field in config.json
When changing the port, update both the env var and the host-side -p flag:

Health check

Add a HEALTHCHECK instruction to your Dockerfile (or pass it at docker run) so Docker can restart unhealthy containers automatically.
Voxray exposes two health endpoints: Use /health for Docker’s HEALTHCHECK. Use /ready for load balancer health checks and Kubernetes readiness probes so traffic is not routed to an instance whose session store is not yet reachable.

Useful environment variables

The table below covers variables most relevant to containerized deployments. See Deployment for the full reference.
In containerized environments, prefer JSON logs (VOXRAY_JSON_LOGS=true) so your log aggregator (Datadog, Loki, CloudWatch) can parse fields without regex extraction.

Image size

The final image is approximately 20–25 MB (uncompressed): ~5 MB for Alpine base, ~15 MB for the stripped Voxray binary. No Go runtime, no build tools, no shell utilities beyond what Alpine includes by default.
The voxray user created in the Dockerfile has no home directory write permissions outside /app. If your config references file paths for TLS certificates or recording temp files, ensure those paths are writable by UID voxray or mount them as volumes.

Next steps