Docker deploy
This guide covers building the RustyGPT container image and running it alongside PostgreSQL with Docker Compose.
Build the image
The repository ships a multi-stage Dockerfile that builds the workspace and bundles the server binary plus
static assets:
docker build -t rustygpt/server:latest -f Dockerfile .
Set BUILD_PROFILE=release to compile with optimisations. The final image exposes the server on port 8080.
Compose stack
docker-compose.yaml defines two services:
backend– builds from the Dockerfile (targetruntime). Environment variables includeDATABASE_URL, OAuth credentials, and feature toggles. Update them to match your deployment.postgres–postgres:17-alpinewith credentials matchingconfig.example.toml.
Bring the stack up:
docker compose up --build
The compose file mounts ./.data/postgres for database storage and ./.data/postgres-init for init scripts. To reuse the
workspace schema, copy the contents of scripts/pg into that directory before the first run:
mkdir -p .data/postgres-init
cp -r scripts/pg/* .data/postgres-init/
Alternatively, rely on the server’s bootstrap runner by exposing the same directory inside the backend container and pointing
[db].bootstrap_path at it.
Configuration and secrets
- Copy
config.example.tomlto a volume or bake it into the image and setRUSTYGPT__CONFIGvariables as needed. - Provide OAuth credentials (
GITHUB_*,APPLE_*) if you plan to use those flows; otherwise the endpoints return placeholder URLs. - Set
features.auth_v1,features.sse_v1, andfeatures.well_knowntotruevia environment variables or the config file. - If running behind TLS terminate HTTPS at the reverse proxy and set
server.public_base_urlto the external URL.
Post-deployment checks
- Hit
http://HOST:8080/healthzandhttp://HOST:8080/readyzuntil both return200. - POST to
/api/setupto create the initial admin account. - Use the CLI container (or a local build) to log in:
docker compose exec backend rustygpt login. - Visit
/metricsand confirm counters increment when making requests. - If using the web UI, serve the
rustygpt-webbuild either from the same container (set[web.static_dir]) or via a separate static host.
Rollback
Tag each release in your registry. To roll back:
docker compose pull backend:previous-tag
docker compose up -d backend
The PostgreSQL data directory is persisted on disk so sessions and conversations remain intact.