-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy pathcompose.yaml
More file actions
246 lines (235 loc) · 7.22 KB
/
compose.yaml
File metadata and controls
246 lines (235 loc) · 7.22 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
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
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
##################################################################################################
# This Compose file is intended to setup a development environment for the Labspace infrastructure,
# NOT for the development of Labspace content.
#
# If you are trying to develop a Labspace, use the `compose.override.content-dev.yaml` file.
##################################################################################################
services:
configurator:
build: ./components/configurator
use_api_socket: true
volumes:
- labspace-content:/project
- labspace-instructions:/instructions
- docker-creds:/docker-creds
- labspace-support:/etc/labspace-support
- ./sample-content-repo:/dev-content:ro
environment:
DEV_MODE: true
develop:
watch:
- path: ./components/configurator
action: rebuild
interface-api:
build:
context: ./components/interface
target: server-dev
volumes:
- labspace-instructions:/labspace/instructions
- type: volume
source: labspace-support
target: /etc/labspace-support/private-key
volume:
subpath: private-key
- type: volume
source: labspace-support
target: /etc/labspace-support/socket
volume:
subpath: socket
- type: volume
source: labspace-support
target: /etc/labspace-support/metadata
volume:
subpath: metadata
environment:
CONTENT_DEV_MODE: true
MARLIN_ENDPOINT: http://marlin-mock:3000/events/v1/track
MARLIN_API_KEY: dev-marlin-api-key
depends_on:
workspace:
condition: service_started
configurator:
condition: service_completed_successfully
restart: unless-stopped
develop:
watch:
- path: ./components/interface/api/src
action: sync
target: /usr/local/app/src
- path: ./components/interface/api/package-lock.json
action: rebuild
- path: ./sample-content-repo/labspace
action: sync
target: /labspace/instructions
interface-client:
build:
context: ./components/interface
target: client-dev
ports:
- 5173:5173
develop:
watch:
- path: ./components/interface/client/src
action: sync
target: /usr/local/app/src
- path: ./components/interface/client/package-lock.json
action: rebuild
# This service is not running anything, but simply building the extension
# and allowing it to be an additional build context for the workspace service
vscode-extension:
build: ./components/support-vscode-extension
workspace:
build:
context: ./components/workspace/base
additional_contexts:
extension: service:vscode-extension
depends_on:
configurator:
condition: service_completed_successfully
socket-proxy:
condition: service_started
ports:
- 8085:8085 # For the IDE itself
- 3000:3000 # For the Node application running in the IDE
volumes:
- socket-proxy:/var/run
- docker-creds:/docker-creds
- labspace-content:/home/coder/project
- type: volume
source: labspace-support
target: /etc/labspace-support/public-key
volume:
subpath: public-key
- type: volume
source: labspace-support
target: /etc/labspace-support/socket
volume:
subpath: socket
develop:
watch:
- path: ./components/workspace
action: rebuild
- path: ./sample-content-repo/project
action: sync
target: /home/coder/project
host-republisher:
build:
context: ./components/host-port-republisher
target: dev
volumes:
- socket-proxy:/var/run
network_mode: service:workspace
environment:
LABEL_FILTER: labspace-resource=true
depends_on:
- workspace
- socket-proxy
develop:
watch:
- path: ./src
action: sync
target: /usr/local/app/src
workspace-cleaner:
build: ./components/workspace-cleaner
volumes:
- socket-proxy:/var/run
environment:
LABEL_FILTER: labspace-resource=true
depends_on:
- socket-proxy
develop:
watch:
- path: ./components/workspace-cleaner
action: rebuild
socket-proxy:
image: mikesir87/docker-socket-proxy:v1.3.1
volumes:
- socket-proxy:/tmp/proxy
- /var/run/docker.sock:/var/run/docker.sock
configs:
- source: docker-proxy-config-labels
target: /etc/docker-socket-proxy/config.d/add-and-require-labels.yaml
- source: docker-proxy-mount-remap
target: /etc/docker-socket-proxy/config.d/mount-path-remap.yaml
- source: docker-proxy-mount-allowlist
target: /etc/docker-socket-proxy/config.d/mount-path-allowlist.yaml
- source: docker-proxy-forward-proxied-socket
target: /etc/docker-socket-proxy/config.d/forward-proxied-socket.yaml
- source: docker-proxy-add-to-labspace-network
target: /etc/docker-socket-proxy/config.d/add-to-labspace-network.yaml
environment:
DEBUG_LOGS: "true"
LISTEN_SOCKET_PATH: /tmp/proxy/docker.sock
marlin-mock:
build: ./components/marlin-mock
ports:
- 3030:3000
environment:
MARLIN_API_KEY: dev-marlin-api-key
develop:
watch:
- path: ./components/marlin-mock/src
action: sync
target: /usr/local/app/src
initial_sync: true
- path: ./components/marlin-mock/package-lock.json
action: rebuild
volumes:
socket-proxy:
name: labspace-socket-proxy
labspace-content:
name: labspace-content
labspace-instructions:
docker-creds:
labspace-support:
networks:
default:
name: labspace
configs:
docker-proxy-config-labels:
content: |
mutators:
# Add labels to all newly created objects
- type: addLabels
labels:
labspace-resource: "true"
responseFilters:
# Only return objects with the labels we mutated on
- type: labelFilter
objectsToFilter:
- containers
- volumes
- networks
requiredLabels:
labspace-resource: "true"
docker-proxy-mount-remap:
content: |
# Remap the project directory to the labspace content volume, since the project
# is running out of a volume.
mutators:
- type: mountPath
from: /home/coder/project
to: labspace-content
docker-proxy-mount-allowlist:
content: |
gates:
- type: mountSource
allowedSources:
- labspace-content
- labspace-socket-proxy
- buildx_buildkit_default_state
- label:labspace-resource=true
docker-proxy-forward-proxied-socket:
content: |
# If requests to use the Docker Socket are used (such as Testcontainers),
# use the proxied one to ensure permissions, remappings, etc. are applied
mutators:
- type: mountPath
from: /var/run/docker.sock
to: labspace-socket-proxy/docker.sock
docker-proxy-add-to-labspace-network:
content: |
mutators:
- type: addToNetwork
networks:
- labspace