Install and configureDocker

Run SlugBase with Docker

Build and run the production Docker image: ports, volumes, health checks, and build-time frontend options.

What you need

  • Docker installed on your server or workstation.
  • Strong values for JWT_SECRET, ENCRYPTION_KEY, and (for production) SESSION_SECRET — see Configuration.
  • A host directory you can mount for SQLite data (default database path inside the container is /app/data/slugbase.db).

The primary Dockerfile at the repository root produces a single container that runs the Node backend and serves the built frontend static assets from public in production mode.

Do not paste real secrets into issue trackers or chat logs. Use a secret store, .env (kept out of git), or your orchestrator’s secret mechanism.

Steps

Prepare environment variables

Create a file (for example .env) or export variables in your shell. At minimum you need the secrets the server validates at startup. When the app is reachable on a public URL, also set BASE_URL and FRONTEND_URL to that HTTPS origin. See Configuration for details.

Get the image

Published image (recommended): pull from Docker Hub:

docker pull mdglabs/slugbase:latest

Build from source: from the repository root (where the Dockerfile lives):

docker build -t slugbase:local .

Use mdglabs/slugbase:latest or slugbase:local as the image name in the next step.

When building from source, you can pass optional build arguments — but the defaults are correct for self-hosted use, so you normally don't need to change them.

Run the container

Map port 5000, persist /app/data, and pass environment variables (example uses --env-file):

mkdir -p ./data
docker run -d \
  --name slugbase \
  -p 5000:5000 \
  -v "$(pwd)/data:/app/data" \
  --env-file .env \
  -e DB_PATH=/app/data/slugbase.db \
  mdglabs/slugbase:latest

The image sets NODE_ENV=production, PORT=5000, and defaults DB_TYPE=sqlite with DB_PATH=/app/data/slugbase.db.

Verify

  • Health: Open http://localhost:5000/api/health — a successful response means the container is running.
  • UI: Open http://localhost:5000. On a fresh database you'll see Initial Setup — follow First run setup.
  • API docs: Browse to /api-docs for the interactive API reference (disable with SLUGBASE_API_DOCS=false).

Backend-only image

The repository also includes Dockerfile.backend for deployments that only need the API (no web UI). Most users should use the main Dockerfile, which includes everything.

Troubleshooting