-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.test.yml
More file actions
50 lines (48 loc) · 1.99 KB
/
docker-compose.test.yml
File metadata and controls
50 lines (48 loc) · 1.99 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
# =============================================================================
# Compose file for `npm run test:docker`
# =============================================================================
#
# Spawns ONE disposable container that runs the full light-runner test suite.
# See Dockerfile.test for the harness image rationale.
#
# Sibling-container pattern: /var/run/docker.sock is bind-mounted so the tests
# can spawn real alpine/python/node/... containers on the HOST daemon. The
# spawned containers are siblings of this one (not nested). Requires Docker
# socket access on the host - on Windows/macOS Docker Desktop handles the
# platform-specific translation.
#
# Lifecycle:
# - `docker compose -f docker-compose.test.yml run --rm --build test`
# builds the image (cached after first time), starts one container,
# runs the tests, and auto-removes the container at exit.
# - The named volumes survive across runs for fast iteration:
# test-node-modules -> /work/node_modules (npm ci cache)
# test-dist -> /work/dist (compiled TS)
# test-npm-cache -> /root/.npm (npm download cache)
# Clean them with `docker compose -f docker-compose.test.yml down -v`.
# =============================================================================
services:
test:
build:
context: .
dockerfile: Dockerfile.test
image: light-runner-tests
working_dir: /work
volumes:
# Live source (the container sees host edits immediately):
- .:/work
# Persistent build/install caches to skip re-install between runs:
- test-node-modules:/work/node_modules
- test-dist:/work/dist
- test-npm-cache:/root/.npm
# Host docker socket for the sibling-container pattern:
- /var/run/docker.sock:/var/run/docker.sock
environment:
CI: "1"
# No interactive TTY - we want clean streaming of test-runner output:
tty: false
stdin_open: false
volumes:
test-node-modules:
test-dist:
test-npm-cache: