-
Notifications
You must be signed in to change notification settings - Fork 0
/
compose.yml
224 lines (220 loc) · 8.31 KB
/
compose.yml
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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
---
include:
- path: compose/base-images.compose.yml
#project_directory: .
- path: compose/proxies.compose.yml
#project_directory: .
- path: compose/vnc.compose.yml
#project_directory: .
services:
dev-shell:
profiles:
- nvim
- podman
- alpine
depends_on:
- container-socket-proxy
- dns
- http-proxy
image: '${IMAGE:-localhost/l7/dev-shell:nvim}'
build:
x-build-images:
- 'localhost/l7/caddy:latest'
- 'localhost/l7/nvim:podman-remote'
- 'localhost/l7/hub:latest'
context: .
dockerfile: imags/dev-shell/Containerfile
args:
BASE_IMAGE: 'localhost/l7/nvim:podman-remote'
tags:
- 'localhost/l7/dev-shell:latest'
- 'localhost/l7/dev-shell:nvim'
hostname: dev
restart: always
user: '1000:1000'
userns_mode: 'keep-id:uid=1000,gid=1000'
networks:
internal:
container-control:
working_dir: "${CWD:-${SRC_DIR:-${L7_SRC_DIR:-/src}}}"
# TODO: mounts for config could be done as configs
# https://github.com/compose-spec/compose-spec/blob/master/08-configs.md
volumes:
- '${CONF_DIR:-${L7_HOME:-${HOME}}/.config/l7ide/config}/ssh.d:/home/user/.ssh/config.d:ro'
- '${CONF_DIR:-${L7_HOME:-${HOME}}/.config/l7ide/config}/git:/home/user/.config/git:ro'
- '${SRC_DIR:-${L7_SRC_DIR:-${PWD}}}:${SRC_DIR:-${L7_SRC_DIR:-${PWD}}}:rshared,nosuid'
- '${SRC_DIR:-${L7_SRC_DIR:-${PWD}}}:/src:rshared,nosuid'
- '${LOCAL_DIR:-user_local}:/home/user/.local'
- 'nvim_state:/home/user/.local/state/nvim:z'
- 'cache_node_yarn_berry:/home/node/.yarn/cache/berry:z,ro'
- 'cache_node_yarn_classic:/home/node/.cache/yarn:z,ro'
- 'cache_node_pnpm:/home/node/.cache/pnpm:z,ro'
- 'cache_node_npm:/home/node/.npm/_cacache:z,ro'
- 'cache_lsp_go:/home/user/.go/:z,ro'
- 'cache_lsp_go_build:/home/user/.cache/go-build/:z,ro'
# TODO: tmpfs mounts not supported under podman-compose
#- target: /tmp
# type: tmpfs
# tmpfs:
# size: 2G
# mode: 0777
- '${SSH_SOCKET:-${SSH_AUTH_SOCK:-/dev/null}}:/home/user/.ssh/SSH_AUTH_SOCK'
# ugly hack around compose insisting on overriding DNS:
# https://github.com/docker/compose/issues/2847
# obviates need for custom entrypoint at cost of hardcoding DNS IP and an extra mount
- '${L7_RESOLV_CONF_PATH:-./compose/mounts/resolv-internal.conf}:/etc/resolv.conf:ro'
#configs:
# - source: resolv_conf_internal
# target: /etc/myresolv.conf
# uid: '0'
# gid: '0'
#sysctls:
# - net.ipv4.ping_group_range: '1000 1000'
env_file:
- path: env
required: false
- path: "${HOME}/.config/l7ide/config/env"
required: false
environment:
SHELL: '${USER_SHELL:-/bin/zsh}'
CONTAINER_DNS: '${CONTAINER_DNS:-10.7.8.133}'
CONTAINER_HOST: 'tcp://10.7.9.2:2375'
GO_RUNNER_IMAGE: '${GO_RUNNER_IMAGE:-localhost/l7/go:1.22-bookworm}'
GPG_IMAGE: '${GPG_IMAGE:-localhost/l7/gpg-vault:pk}'
NODE_RUNNER_IMAGE: '${NODE_RUNNER_IMAGE:-localhost/l7/node}'
L7_NODE_VERSION: '${L7_NODE_VERSION:-20}'
HOME: /home/user
L7_HOME: '${L7_HOME:-${HOME}}'
CONF_DIR: '${CONF_DIR:-${L7_HOME:-${HOME}}/.config/l7ide/config}'
SRC_DIR: '${SRC_DIR:-${L7_SRC_DIR:-${PWD}}}'
ROOT_DIR: '${L7_ROOT_DIR:-${ROOT_DIR:-${PWD}}}'
L7_NVIM_STATE_PATH: 'l7_nvim_state'
L7_NPM_CACHE_VOLUME: 'l7_cache_node_npm'
L7_PNPM_CACHE_VOLUME: 'l7_cache_node_pnpm'
L7_YARN_BERRY_CACHE_VOLUME: 'l7_cache_node_yarn_berry'
L7_YARN_CLASSIC_CACHE_VOLUME: 'l7_cache_node_yarn_classic'
L7_GO_HOME_VOLUME: 'l7_cache_lsp_go'
L7_GO_BUILD_VOLUME: 'l7_cache_lsp_go_build'
GPG_PK_VOLUME: '${GPG_PK_VOLUME:-l7_gpgvault_pk}'
L7_COMPOSE_NETWORK_NAME_INTERNAL: 'l7_dev_internal'
L7_RESOLV_CONF_PATH: '${L7_RESOLV_CONF_PATH:-${ROOT_DIR:-${PWD}}/compose/mounts/resolv-internal.conf}'
SSH_AUTH_SOCK: '/home/user/.ssh/SSH_AUTH_SOCK'
SSH_SOCKET: '${SSH_SOCKET:-}'
L7_DISPLAY: '${L7_DISPLAY:-}'
#L7_X11_SOCKET_VOLUME: '${L7_X11_SOCKET_VOLUME:-/tmp/.X11-unix}'
L7_X11_SOCKET_VOLUME: '${L7_X11_SOCKET_VOLUME:-l7_dev_desktop_x11_unix}'
#L7_XAUTHORITY: '${L7_XAUTHORITY:-${XAUTHORITY:-${HOME}/.Xauthority}}'
L7_XAUTHORITY: '${L7_XAUTHORITY:-${XAUTHORITY:-}}'
L7_XAUTHORITY_VOLUME: '${L7_XAUTHORITY_VOLUME:-l7_dev_desktop_x11_xauthority}'
# setting TMUX='' fixes fonts
TMUX: ''
dns: '${CONTAINER_DNS:-10.7.8.133}'
entrypoint: /bin/sh
command: -c 'sleep 36000000000'
xterm:
profiles:
- podman
- xterm
image: 'localhost/l7/dev-terminal:xterm'
build:
x-build-images:
- 'localhost/l7/xterm:x11'
context: .
dockerfile: imags/X11/dev-terminal/Containerfile
args:
BASE_IMAGE: '${XTERM_IMAGE:-localhost/l7/xterm:x11}'
tags:
- 'localhost/l7/dev-terminal:xterm'
- 'localhost/l7/dev-terminal:latest'
hostname: localhost
restart: never
user: '1000:1000'
networks:
container-control:
working_dir: /home/user
# TODO: mounts for config could be done as configs
# https://github.com/compose-spec/compose-spec/blob/master/08-configs.md
volumes:
- '${L7_XAUTHORITY_VOLUME:-desktop_x11_xauthority}:/etc/x11/xauthority'
- '${L7_X11_SOCKET_VOLUME:-desktop_x11_unix}:/tmp/.X11-unix'
environment:
SHELL: '${USER_SHELL:-/bin/zsh}'
CONTAINER_DNS: '${CONTAINER_DNS:-10.7.8.133}'
CONTAINER_HOST: 'tcp://10.7.9.2:2375'
DOCKER_HOST: 'tcp://10.7.9.2:2375'
GO_RUNNER_IMAGE: '${GO_RUNNER_IMAGE:-localhost/l7/go:1.22-bookworm}'
GPG_IMAGE: '${GPG_IMAGE:-localhost/l7/gpg-vault:pk}'
NODE_RUNNER_IMAGE: '${NODE_RUNNER_IMAGE:-localhost/l7/node}'
L7_NODE_VERSION: '${L7_NODE_VERSION:-20}'
HOME: /home/user
L7_HOME: '${L7_HOME:-${HOME}}'
CONF_DIR: '${CONF_DIR:-${L7_HOME:-${HOME}}/.config/l7ide/config}'
SRC_DIR: '${SRC_DIR:-${L7_SRC_DIR:-${PWD}}}'
ROOT_DIR: '${L7_ROOT_DIR:-${ROOT_DIR:-${PWD}}}'
L7_NVIM_STATE_PATH: 'l7_nvim_state'
L7_NPM_CACHE_VOLUME: 'l7_cache_node_npm'
L7_PNPM_CACHE_VOLUME: 'l7_cache_node_pnpm'
L7_YARN_BERRY_CACHE_VOLUME: 'l7_cache_node_yarn_berry'
L7_YARN_CLASSIC_CACHE_VOLUME: 'l7_cache_node_yarn_classic'
L7_GO_HOME_VOLUME: 'l7_cache_lsp_go'
L7_GO_BUILD_VOLUME: 'l7_cache_lsp_go_build'
GPG_PK_VOLUME: '${GPG_PK_VOLUME:-l7_gpgvault_pk}'
L7_COMPOSE_NETWORK_NAME_INTERNAL: 'l7_dev_internal'
L7_RESOLV_CONF_PATH: '${L7_RESOLV_CONF_PATH:-${ROOT_DIR:-${PWD}}/compose/mounts/resolv-internal.conf}'
SSH_SOCKET: '${SSH_SOCKET:-${SSH_AUTH_SOCK:-}}'
DISPLAY: '${L7_DISPLAY:-:1.0}'
L7_DISPLAY: '${L7_DISPLAY:-:1.0}'
L7_X11_SOCKET_VOLUME: '${L7_X11_SOCKET_VOLUME:-l7_dev_desktop_x11_unix}'
#L7_XAUTHORITY: '${L7_XAUTHORITY:-${XAUTHORITY:-${HOME}/.Xauthority}}'
XAUTHORITY: '/etc/x11/xauthority/Xauthority'
L7_XAUTHORITY: '${L7_XAUTHORITY:-${XAUTHORITY:-}}'
L7_XAUTHORITY_VOLUME: '${L7_XAUTHORITY_VOLUME:-l7_dev_desktop_x11_xauthority}'
entrypoint: /usr/local/bin/xterm
#########################################################
volumes:
user_local:
name: l7_dev_user_local
caddy_conf:
name: l7_caddy_fwd_config
cache_node_npm:
name: l7_cache_node_npm
cache_node_pnpm:
name: l7_cache_node_pnpm
cache_node_yarn_berry:
name: l7_cache_node_yarn_berry
cache_node_yarn_classic:
name: l7_cache_node_yarn_classic
cache_lsp_go:
name: l7_cache_lsp_go
cache_lsp_go_build:
name: l7_cache_lsp_go_build
nvim_state:
name: l7_nvim_state
gpgvault_pk:
name: l7_gpgvault_pk
## x11
desktop_user_firefox:
name: l7_dev_desktop_user_firefox
networks:
internal:
name: l7_dev_internal
attachable: true
internal: true
ipam:
config:
- subnet: 10.7.8.0/24
ip_range: 10.7.8.0/27
driver: bridge
driver_opts:
inhibit_ipv4: '1'
container-control:
name: l7_dev_container_control
attachable: true
internal: true
ipam:
config:
- subnet: 10.7.9.0/27
ip_range: 10.7.9.16/28
driver: bridge
driver_opts:
inhibit_ipv4: '1'