-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
104 lines (104 loc) · 5.35 KB
/
Copy pathdocker-compose.yml
File metadata and controls
104 lines (104 loc) · 5.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# docker-compose.yml - generic devcontainer runtime
#
# Why this exists:
# - Uses the generated merged Dockerfile and custom entrypoint instead of a
# stock image.
# - Keeps the runtime reusable for repository roots and Git worktrees without
# product-specific environment variable names.
# - Mounts either the consuming repository root or the BRANCH-selected managed
# worktree at the same absolute path inside the container.
# - Mounts the consuming repository root at its host path as a second bind so
# linked Git worktree metadata resolves inside the container.
# - Provides the image build, privileged Docker-in-Docker runtime, and local env
# injection.
# - Uses host networking so the generated SSH X11 forwarding value such as
# `DEVCONTAINER_DISPLAY=localhost:10.0` still points at the host-side SSH X11
# listener from inside the container.
# - Passes `/dev/kvm` through explicitly and adds its numeric group so the
# workspace user can run KVM-accelerated QEMU without regenerating old local
# compose overlays on the common host group id.
#
# Inputs:
# - CONTAINER_USER, CONTAINER_GROUP, CONTAINER_UID, and CONTAINER_GID customize
# the workspace user created by the Dockerfile.
# - UID selects the numeric runtime user and group for bind-mounted workspaces.
# - compose.local.gen.yml sets the generated container hostname and Compose
# project name.
# - compose.user.gen.yml carries the optional `.codegeist/compose.local.yml`
# override through a generated file that always exists for Dev Containers.
# - BRANCH selects `../.worktrees/<branch>` as the workspace source when set.
# - DEVCONTAINER_WORKSPACE_FOLDER and DEVCONTAINER_REPO_ROOT are generated by
# initialize.sh and are used as matching in-container mount targets.
# - DEVCONTAINER_KVM_GID is generated by initialize.sh from `stat -c %g
# /dev/kvm`; KVM_GID can override older generated env files manually.
# - DEVCONTAINER_DISPLAY is generated by initialize.sh from the host-side DISPLAY
# visible to initializeCommand. Compose injects it when the container is
# created; the Chrome launcher rereads and validates the candidate so VS Code
# SSH reconnect can refresh X11 state without recreating the container.
# - DEVCONTAINER_XAUTHORITY points into the selected workspace. initialize.sh
# atomically refreshes that ignored file after an SSH reconnect, avoiding a
# stale bind mount when the host replaces its original Xauthority file.
# - When initialize.sh sees a live host Wayland socket, compose.local.gen.yml
# mounts only that socket and sets its container-side runtime variables. Static
# Wayland mounts are avoided so SSH-only hosts never receive an invalid bind.
# This Compose file does not mount host-local `/tmp/.X11-unix` sockets.
# - OPENCODE_DIR_CONFIG, OPENCODE_DIR_SHARE, and OPENCODE_DIR_STATE select the
# host-side OpenCode state directories mounted into the container.
# - initialize.sh writes `.devcontainer/Dockerfile.merged.gen` before Compose
# builds; this keeps project-local `.codegeist/Dockerfile` extensions outside
# the submodule.
#
# Related files:
# - devcontainer.json
# - Dockerfile
# - Dockerfile.base
# - ../.codegeist/Dockerfile
# - Dockerfile.merged.gen
# - entrypoint.sh
# - initialize.sh
# - ../.codegeist/compose.local.yml
# - .env
# - compose.local.gen.yml
# - compose.user.gen.yml
# - ../.codegeist/.local.env
services:
workspace:
build:
context: ..
dockerfile: .devcontainer/Dockerfile.merged.gen
args:
CONTAINER_USER: ${CONTAINER_USER:-${USER:-vscode}}
CONTAINER_GROUP: ${CONTAINER_GROUP:-${USER:-vscode}}
CONTAINER_UID: ${CONTAINER_UID:-1000}
CONTAINER_GID: ${CONTAINER_GID:-${UID:-1000}}
command: sleep infinity
hostname: ${DEVCONTAINER_HOSTNAME:-devcontainer}
user: "${UID:-1000}:${UID:-1000}"
privileged: true
devices:
- /dev/kvm:/dev/kvm
group_add:
- "${DEVCONTAINER_KVM_GID:-${KVM_GID:-993}}"
init: true
network_mode: host
# Chrome and other browser processes need more than Docker's tiny default /dev/shm.
shm_size: '1gb'
extra_hosts:
- host.docker.internal:host-gateway
env_file:
- path: .env
required: false
- path: ../.codegeist/.local.env
required: false
environment:
OPENCODE_EXPERIMENTAL_DISABLE_FILEWATCHER: ${OPENCODE_EXPERIMENTAL_DISABLE_FILEWATCHER:-true}
DEVCONTAINER_WORKSPACE_FOLDER: ${DEVCONTAINER_WORKSPACE_FOLDER:?DEVCONTAINER_WORKSPACE_FOLDER must be generated by initialize.sh}
DISPLAY: ${DEVCONTAINER_DISPLAY:-}
XAUTHORITY: ${DEVCONTAINER_XAUTHORITY:-${DEVCONTAINER_WORKSPACE_FOLDER}/.devcontainer/.Xauthority.gen}
QT_X11_NO_MITSHM: "1"
volumes:
- ${DEVCONTAINER_WORKSPACE_FOLDER:?DEVCONTAINER_WORKSPACE_FOLDER must be generated by initialize.sh}:${DEVCONTAINER_WORKSPACE_FOLDER:?DEVCONTAINER_WORKSPACE_FOLDER must be generated by initialize.sh}:cached
- ${DEVCONTAINER_REPO_ROOT:?DEVCONTAINER_REPO_ROOT must be generated by initialize.sh}:${DEVCONTAINER_REPO_ROOT:?DEVCONTAINER_REPO_ROOT must be generated by initialize.sh}:cached
- ${OPENCODE_DIR_CONFIG:-/home/${USER:-vscode}/.config/opencode}:/home/${USER:-vscode}/.config/opencode
- ${OPENCODE_DIR_SHARE:-/home/${USER:-vscode}/.local/share/opencode}:/home/${USER:-vscode}/.local/share/opencode
- ${OPENCODE_DIR_STATE:-/home/${USER:-vscode}/.local/state/opencode}:/home/${USER:-vscode}/.local/state/opencode