From 60208b22033a866ca1c4fe130cca331d830fa08d Mon Sep 17 00:00:00 2001 From: Joakim Persson Date: Wed, 22 Apr 2026 21:21:22 +0200 Subject: [PATCH] Auto-detect username for volume isolation in own-account mode MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The previous SIGNUM variable was required (${SIGNUM:?...}), which broke for users with their own OS accounts who shouldn't need to set anything manually. Replace with ${SIGNUM:-${USER}} so: - Own-account mode: leave SIGNUM unset in .env — project name and container name default to devbox-$USER automatically. Each OS user gets isolated volumes with zero configuration. - Shared-account mode: set SIGNUM= in .env as before. Both container_name and the top-level name: field use the same fallback, so volumes and container names stay consistent. Updated .env.shared.example to document both modes with the SIGNUM line commented out by default (own-account is the common case). --- .env.shared.example | 12 +++++++++--- docker-compose.shared.yml | 20 +++++++++++++------- 2 files changed, 22 insertions(+), 10 deletions(-) diff --git a/.env.shared.example b/.env.shared.example index ac090db..859a602 100644 --- a/.env.shared.example +++ b/.env.shared.example @@ -1,7 +1,13 @@ # ── Shared machine setup ───────────────────────────────────────────── -# Your corporate signum / username (REQUIRED) -# This isolates your container, config, and data from other users. -SIGNUM=your-signum-here +# SIGNUM isolates your container name and named volumes from other users. +# +# Own-account mode (each user has their own OS login): +# Leave SIGNUM commented out — it defaults to your OS username ($USER). +# SIGNUM= +# +# Shared-account mode (everyone logs in as the same OS user): +# Uncomment and set to your unique identifier. +# SIGNUM=your-signum-here # ── Provider ───────────────────────────────────────────────────────── OPENCODE_PROVIDER=amazon-bedrock diff --git a/docker-compose.shared.yml b/docker-compose.shared.yml index 7849fea..80d451b 100644 --- a/docker-compose.shared.yml +++ b/docker-compose.shared.yml @@ -12,18 +12,24 @@ # 5. mkdir -p ~//.config/opencode # 6. docker compose up -d # -# Volume isolation: the top-level 'name:' field uses SIGNUM to derive a -# unique project name (devbox-), which Docker Compose uses as the -# prefix for all named volumes. Without this, two users whose compose file -# lives in a directory with the same basename would share volumes — the -# Docker daemon is system-wide and doesn't scope by OS user. +# Volume isolation: the top-level 'name:' field derives a unique project +# name per user, which Docker Compose uses as the prefix for all named +# volumes. Without this, two users whose compose file lives in a directory +# with the same basename would share volumes — the Docker daemon is +# system-wide and doesn't scope by OS user. +# +# Two modes: +# Own-account mode (each user has their own OS login): +# Leave SIGNUM unset in .env — it defaults to $USER automatically. +# Shared-account mode (everyone logs in as the same OS user): +# Set SIGNUM= in .env so each person gets isolated volumes. -name: devbox-${SIGNUM:?Set SIGNUM in .env} +name: devbox-${SIGNUM:-${USER}} services: devbox: image: joakimp/opencode-devbox:latest - container_name: devbox-${SIGNUM:?Set SIGNUM in .env} + container_name: devbox-${SIGNUM:-${USER}} stdin_open: true tty: true env_file: