-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
96 lines (91 loc) · 3.41 KB
/
Copy pathdocker-compose.yml
File metadata and controls
96 lines (91 loc) · 3.41 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
# Local environment for checking the service end to end: a JS-rendered test site,
# a real headless Chrome, and an S3-compatible storage.
#
# make compose.up # site + browser + storage
# make compose.run # one prerender run against them
# make compose.pages # what ended up in storage
#
# Storage defaults to s3 (MinIO) so the S3 path is exercised; override with
# STORAGE=local to write into ./.pages instead.
services:
testsite:
image: nginx:1.29-alpine
volumes:
- ./docker/testsite/index.html:/usr/share/nginx/html/index.html:ro
- ./docker/testsite/sitemap.xml:/usr/share/nginx/html/sitemap.xml:ro
- ./docker/testsite/sitemap_pages.xml:/usr/share/nginx/html/sitemap_pages.xml:ro
- ./docker/testsite/nginx.conf:/etc/nginx/conf.d/default.conf:ro
healthcheck:
# 127.0.0.1, not localhost: busybox wget tries ::1 first and nginx here only
# listens on IPv4.
test: ["CMD", "wget", "-q", "-O-", "http://127.0.0.1/sitemap.xml"]
interval: 3s
timeout: 3s
retries: 10
chrome:
image: chromedp/headless-shell:latest
# No command override on purpose: the image's run.sh already starts Chrome on
# 9223 and fronts it with socat on 9222. Passing --remote-debugging-port=9222
# here makes Chrome fight socat for the port and neither ends up serving.
command:
- --remote-allow-origins=*
# Chrome needs more than the default 64MB of shared memory for real pages.
shm_size: 1gb
healthcheck:
# The image has no wget/curl, so probe the port with bash's /dev/tcp: this
# checks that socat is actually accepting, not just that the binary exists.
test: ["CMD", "bash", "-c", "exec 3<>/dev/tcp/127.0.0.1/9222"]
interval: 3s
timeout: 3s
retries: 20
minio:
image: minio/minio:latest
command: server /data --console-address ":9001"
environment:
MINIO_ROOT_USER: prerender
MINIO_ROOT_PASSWORD: prerender123
# Non-default host ports: 9000/9001 are routinely taken by some other local
# environment. Override with MINIO_PORT / MINIO_CONSOLE_PORT.
ports:
- "${MINIO_PORT:-19000}:9000"
- "${MINIO_CONSOLE_PORT:-19001}:9001"
healthcheck:
test: ["CMD", "mc", "ready", "local"]
interval: 3s
timeout: 3s
retries: 20
# Creates the bucket and opens it for reading, the way a CDN origin would be.
minio-init:
image: minio/mc:latest
depends_on:
minio:
condition: service_healthy
entrypoint: >
/bin/sh -c "
mc alias set local http://minio:9000 prerender prerender123 &&
mc mb --ignore-existing local/prerender-pages &&
mc anonymous set download local/prerender-pages
"
prerender:
build:
context: .
dockerfile: docker/Dockerfile
args:
GO_VER: ${GO_VER:-1.26.5}
depends_on:
testsite:
condition: service_healthy
chrome:
condition: service_healthy
minio-init:
condition: service_completed_successfully
environment:
# Stage config lives in configuration/<stage> and is merged over the shipped
# defaults. `docker` writes to MinIO; `docker-local` writes to ./.pages.
CONFIG_PATH: /app/configuration
STAGE: ${STAGE:-docker}
volumes:
- ./configuration:/app/configuration:ro
- ./.pages:/app/.pages
# Nothing to serve: this is a batch job, run it explicitly with `make compose.run`.
profiles: ["run"]