-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
97 lines (97 loc) · 3.13 KB
/
docker-compose.yml
File metadata and controls
97 lines (97 loc) · 3.13 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
services:
generate-certs:
image: smallstep/step-ca:latest
container_name: generate-certs
volumes:
- ${CONTEXT_PATH}/certs/:/tmp/step-ca
- ${CONTEXT_PATH}/generate-certs.sh:/tmp/generate-certs.sh
user: ${USER_GROUP}
working_dir: /tmp/step-ca
entrypoint: ["/bin/sh", "/tmp/generate-certs.sh"]
restart: "no"
environment:
- DOCKER_STEPCA_INIT_NAME=Smallstep Root CA
- DOCKER_STEPCA_INIT_DNS_NAMES=mail.example.test,example.test,localhost
tunnel:
build:
dockerfile: Dockerfile.tunnel
container_name: tunnel
command: ["/bin/sh", "/tunnel.sh"]
ports:
- "4300:4300"
- "4301:4301"
environment:
- TCP_TUNNELS=${TCP_TUNNELS}
# healthcheck:
# test: ["CMD", "curl", "-f", "http://localhost:4300/urls"]
# interval: 5s
# timeout: 3s
# retries: 10
# start_period: 10s
depends_on:
create-accounts:
condition: service_completed_successfully
mailserver:
image: ghcr.io/docker-mailserver/docker-mailserver:latest
stop_grace_period: 5s
container_name: mailserver
hostname: mail.example.test
ports:
- "587:587" # ESMTP (explicit TLS => STARTTLS)
- "993:993" # IMAP4 (implicit TLS)
volumes:
- ${CONTEXT_PATH}/certs/:/tmp/docker-mailserver/ssl/
- /etc/localtime:/etc/localtime:ro
environment:
- SSL_TYPE=self-signed
restart: always
depends_on:
generate-certs:
condition: service_completed_successfully
healthcheck:
test: "ss --listening --ipv4 --tcp | grep --silent ':smtp' || exit 1"
interval: 5s
timeout: 3s
retries: 5
start_period: 45s
create-accounts:
image: docker:24-cli
container_name: create-accounts
entrypoint: ["/bin/sh", "-c"]
command:
- apk add --no-cache bash >/dev/null && cd /work && ./create-accounts.sh
volumes:
- ${CONTEXT_PATH}/:/work
- /var/run/docker.sock:/var/run/docker.sock
depends_on:
mailserver:
# Do not use service_healthy: Dovecot (and sometimes the :smtp check) stays
# down until accounts exist, while create-accounts waits for healthy — deadlock.
condition: service_started
restart: "no"
testbench:
build:
context: .
dockerfile: Dockerfile
container_name: testbench
environment:
- URL=${URL}
- SITE_NAME=CI
- INSTANCE_USERNAME=admin
- INSTANCE_PASSWORD=${INSTANCE_PASSWORD}
- TCP_TUNNELS=${TCP_TUNNELS:-mailserver:587 mailserver:993}
- TUNNEL_SERVICE_URL=${TUNNEL_SERVICE_URL:-http://tunnel}
volumes:
# - ./sites.json:/app/sites.json
- ./playwright-report:/app/playwright-report
- ./test-results:/app/test-results
# for making changes to code without rebuilding the container
# - ./src:/app/src
# depends_on:
# create-accounts:
# # Accounts must exist before tests; mailserver health can lag Dovecot until setup runs.
# condition: service_completed_successfully
# tunnel:
# # Tunnel healthcheck hits /urls once reverse tunnels to mail ports are up.
# condition: service_healthy
restart: "no"