Repository navigation
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
61 lines (59 loc) · 2.12 KB
/
Copy pathdocker-compose.yml
File metadata and controls
61 lines (59 loc) · 2.12 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
services:
app:
build:
context: .
dockerfile: backend/Dockerfile
ports:
- "127.0.0.1:${LOCALCODE_PORT:-4173}:4173"
volumes:
- localcode-data:/data
- runner-socket:/run/localcode:ro
# Repo-kept problems: `git pull` then Refresh content picks up changes without a rebuild.
- ./content:/content:ro
environment:
LOCALCODE_RUNNER: unix:/run/localcode
# Host names the app answers to (comma-separated); add one to reach it by another name.
LOCALCODE_ALLOWED_HOSTS: ${LOCALCODE_ALLOWED_HOSTS:-localhost,127.0.0.1,::1}
# Optional fallbacks if an upstream disappears (comma-separated):
LOCALCODE_DATASET_MIRRORS: ${LOCALCODE_DATASET_MIRRORS:-}
LOCALCODE_DOOCS_MIRRORS: ${LOCALCODE_DOOCS_MIRRORS:-}
LOCALCODE_COMPANIES_MIRRORS: ${LOCALCODE_COMPANIES_MIRRORS:-}
read_only: true
tmpfs:
- /tmp
security_opt: [no-new-privileges:true]
# Only the entrypoint uses these, to hand /data to the app user before dropping root.
cap_drop: [ALL]
cap_add: [CHOWN, SETUID, SETGID]
depends_on: [runner]
restart: unless-stopped
# Executes user code. It has no network at all; the app talks to it over a Unix socket.
runner:
build:
context: ./runner
target: runtime
network_mode: none
init: true # reaps orphaned processes left by submissions
volumes:
- runner-socket:/run/localcode
environment:
RUNNER_SOCKET_DIR: /run/localcode
RUNNER_SOCKET_GID: "1000" # the app user's group
read_only: true
tmpfs:
- /tmp:exec,size=512m
shm_size: 16m
# Caps SysV shared memory, which counts against mem_limit and outlives the process that made it.
sysctls:
kernel.shmmax: 16777216 # bytes per segment
kernel.shmall: 4096 # pages in total
security_opt: [no-new-privileges:true]
# The root server needs these to prepare each sandbox, drop to the sandbox user, and clean up.
cap_drop: [ALL]
cap_add: [CHOWN, DAC_OVERRIDE, FOWNER, SETUID, SETGID, KILL]
mem_limit: 2g
pids_limit: 512
restart: unless-stopped
volumes:
localcode-data:
runner-socket: