---
title: Production Docker deployment | Space Works Workspace docs
description: Documentation index · VPS installer · Images. Production Docker deployment in the Space Works Workspace documentation: install and run.
url: https://spaceworkslabs.tech/docs/workspace/deployment-docker/
updated: 2026-11-12
---

[Space Works Workspace](https://spaceworkslabs.tech/docs/workspace/) Overview
- [Overview](https://spaceworkslabs.tech/docs/workspace/overview/)
- [Roles and access](https://spaceworkslabs.tech/docs/workspace/roles/)
- [Integrations setup](https://spaceworkslabs.tech/docs/workspace/integrations/)
- [Monitoring Space Works services](https://spaceworkslabs.tech/docs/workspace/monitoring/)
Install and run
- [Host the complete stack on a VPS](https://spaceworkslabs.tech/docs/workspace/deployment-vps/)
- [Production Docker deployment](https://spaceworkslabs.tech/docs/workspace/deployment-docker/)
- [Cloud deployment](https://spaceworkslabs.tech/docs/workspace/deployment-cloud/)
- [Netlify frontend with a Docker VPS backend](https://spaceworkslabs.tech/docs/workspace/deployment-split/)
- [AWS deployment](https://spaceworkslabs.tech/docs/workspace/deployment-aws/)
- [Kubernetes deployment](https://spaceworkslabs.tech/docs/workspace/deployment-kubernetes/)
- [Configuration](https://spaceworkslabs.tech/docs/workspace/configuration/)
Developers
- [Space Works machine API (/api/v1)](https://spaceworkslabs.tech/docs/workspace/api/)
- [Space Works MCP server](https://spaceworkslabs.tech/docs/workspace/mcp/)
[All docs](https://spaceworkslabs.tech/docs/)

Space Works Workspace · Install and run

# Production Docker deployment

[Documentation index](https://github.com/SpaceWorks-Labs/SpaceWorks-Workspace/blob/95081f02383e0b81e13cf963b905d99ad5868713/docs/README.md) ·[VPS installer](https://spaceworkslabs.tech/docs/workspace/deployment-vps/) ·[Images](https://github.com/SpaceWorks-Labs/SpaceWorks-Workspace/blob/95081f02383e0b81e13cf963b905d99ad5868713/docs/CONTAINER_IMAGES.md)

For a complete server use the VPS installer. This guide runs the backend image with separately supplied PostgreSQL 16, Redis, S3-compatible storage and SMTP. Terminate HTTPS at a trusted proxy; publish only a private container port.

## Images and runtime

Pull an immutable`ghcr.io/spaceworks-labs/spaceworks-workspace-backend:<release>`. It serves the whole application by default. Run`migrate`once before the web rollout using an administration connection. Runtime connections should have only data privileges. Use TLS for PostgreSQL, Redis and custom S3 endpoints. `export SWW_VERSION=0.1.0-main.42.a1b2c3d4e5f6 image="ghcr.io/spaceworks-labs/spaceworks-workspace-backend:$SWW_VERSION" docker pull "$image" docker run --rm --env-file /secure/workspace-migration.env "$image" migrate docker run -d --name spaceworks-workspace --restart unless-stopped \ --env-file /secure/workspace-runtime.env -p 127.0.0.1:3000:3000 "$image"`

Environment files stay outside Git, mode 600. Configure all production variables in[Configuration](https://spaceworkslabs.tech/docs/workspace/configuration/) , including independent vault, integration and MFA keys. The container runs as uid 1001; operator tools run as root only when needed. Only public CA certificates enter runtime mounts.

The proxy must overwrite the configured client-IP header, preserve Host and forward HTTPS protocol. Disable buffering for`/api/realtime/*`, document presence and assistant streams. Allow upload bodies up to 30 MB and idle reads longer than the stream heartbeat. Keep data and storage administration ports private.

## Building your own image `docker build --target runner \ --build-arg NEXT_PUBLIC_BASE_URL=https://spaceworks-workspace-origin.invalid \ --secret id=NEXT_SERVER_ACTIONS_ENCRYPTION_KEY,env=NEXT_SERVER_ACTIONS_ENCRYPTION_KEY \ -t spaceworks-workspace-backend:reviewed .`

The frontend target additionally takes`NEXT_PUBLIC_BACKEND_ORIGIN`. CI builds both architectures; the Dockerfile's last target is the backend for providers that cannot choose a target. Release images apply public origin placeholders at start and require each installation's own stable action key. Builders without BuildKit secrets may use the identically named build argument; it remains in the builder metadata/cache, so prefer secret mounts.

## Migrations, health and jobs

`DIRECT_URL`defaults to`DATABASE_URL`; use a direct/session connection when the runtime uses a transaction pooler.`MIGRATE_ON_START=1`applies migrations before the server on platforms without release jobs. Use a one-shot migration with multiple replicas. A failed migration blocks startup.

`GET /api/health`is public liveness.`GET /api/health/db`requires`Authorization: Bearer $HEALTHCHECK_SECRET`. Run separate worker and beat containers from the same backend image:`node dist/worker.js`and`node dist/beat.js`, with the backend runtime environment, database and native persistent Redis access. Do not publish port 3460; probe`/health`privately. Give worker up to ten minutes to drain on SIGTERM. Beat needs one replica.

If an external cron replaces beat, call`POST /api/internal/outbox`and`POST /api/internal/jobs`every minute with`Authorization: Bearer $CRON_SECRET`.`node scripts/scheduler.mjs --once`provides the tick with`APP_URL`and`CRON_SECRET`. Endpoints enqueue; keep worker running. They return 503 if Redis is unavailable. See[background jobs](https://github.com/SpaceWorks-Labs/SpaceWorks-Workspace/blob/95081f02383e0b81e13cf963b905d99ad5868713/docs/areas/jobs-queue.md) .

Back up the database, objects and encryption keys before changing releases. Retain the previous image until checks pass. Application rollback does not reverse migrations. The backend contains operator tools and the Prisma CLI; database archive tools require PostgreSQL clients in a trusted checkout or use the VPS's database container. Never seed demo data on production.

From[SpaceWorks-Workspace/docs/DEPLOYMENT_DOCKER.md](https://github.com/SpaceWorks-Labs/SpaceWorks-Workspace/blob/95081f02383e0b81e13cf963b905d99ad5868713/docs/DEPLOYMENT_DOCKER.md) at 95081f0, updated 2026-11-12.[Suggest a change](https://github.com/SpaceWorks-Labs/SpaceWorks-Workspace/edit/main/docs/DEPLOYMENT_DOCKER.md)  [PreviousHost the complete stack on a VPS](https://spaceworkslabs.tech/docs/workspace/deployment-vps/) [NextCloud deployment](https://spaceworkslabs.tech/docs/workspace/deployment-cloud/)

On this page
- [Images and runtime](#images-and-runtime)
- [Building your own image](#building-your-own-image)
- [Migrations, health and jobs](#migrations-health-and-jobs)
