-
Notifications
You must be signed in to change notification settings - Fork 268
Expand file tree
/
Copy pathcompose.yaml
More file actions
127 lines (120 loc) · 4.15 KB
/
Copy pathcompose.yaml
File metadata and controls
127 lines (120 loc) · 4.15 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
# SMF development environment.
#
# docker compose up -d --build
# -> http://localhost:8080/install.php
#
# Both database engines SMF supports are running. MySQL is what the forum is
# pointed at by default; set SMF_DB_TYPE=postgresql in .env to use the other.
#
# Everything below has a working default, so no .env file is required. Copy
# .docker/env.example to .env if you want to change ports or credentials.
name: smf-dev
services:
web:
build:
context: .
dockerfile: .docker/php/Dockerfile
args:
PHP_VERSION: ${PHP_VERSION:-8.4}
ports:
- "${WEB_PORT:-8080}:80"
volumes:
# The checkout is bind-mounted, so edits on the host are live immediately.
- .:/var/www/html
environment:
# Which engine the generated Settings.php points at: mysql or postgresql.
SMF_DB_TYPE: ${SMF_DB_TYPE:-mysql}
SMF_DB_NAME: ${DB_NAME:-smf}
SMF_DB_USER: ${DB_USER:-smf}
SMF_DB_PASSWD: ${DB_PASSWORD:-smf}
# Per-engine host and port, so switching SMF_DB_TYPE is the only change
# needed. These are container-internal, not the host ports below.
SMF_MYSQL_SERVER: mysql
SMF_MYSQL_PORT: "3306"
SMF_POSTGRES_SERVER: postgres
SMF_POSTGRES_PORT: "5432"
SMF_BOARDURL: http://localhost:${WEB_PORT:-8080}
depends_on:
mysql:
condition: service_healthy
postgres:
condition: service_healthy
restart: unless-stopped
mysql:
image: mysql:${MYSQL_VERSION:-8.4}
ports:
# Exposed on 3307 by default so it cannot collide with a local mysql.
- "${MYSQL_PORT:-3307}:3306"
environment:
MYSQL_DATABASE: ${DB_NAME:-smf}
MYSQL_USER: ${DB_USER:-smf}
MYSQL_PASSWORD: ${DB_PASSWORD:-smf}
MYSQL_ROOT_PASSWORD: ${DB_ROOT_PASSWORD:-smf}
# SMF creates its tables as InnoDB/utf8mb4, so match that at server level
# rather than relying on whichever defaults the image ships with. The
# collation is deliberately left to the charset default: SMF's own DDL says
# `DEFAULT CHARSET=utf8mb4` with no COLLATE, so forcing a different one here
# would only apply to objects SMF did not create, and the two would diverge.
command:
- --character-set-server=utf8mb4
- --default-storage-engine=InnoDB
volumes:
- mysql-data:/var/lib/mysql
- ./.docker/mysql/init:/docker-entrypoint-initdb.d:ro
healthcheck:
test: ["CMD-SHELL", "mysqladmin ping -h 127.0.0.1 --silent"]
interval: 3s
timeout: 5s
retries: 40
start_period: 20s
restart: unless-stopped
postgres:
image: postgres:${POSTGRES_VERSION:-17-alpine}
# Also reachable as `db`, which is what installs made before MySQL was
# added have in their Settings.php.
networks:
default:
aliases:
- db
ports:
# Exposed on 5433 by default so it cannot collide with a local postgres.
- "${POSTGRES_PORT:-5433}:5432"
environment:
POSTGRES_DB: ${DB_NAME:-smf}
POSTGRES_USER: ${DB_USER:-smf}
POSTGRES_PASSWORD: ${DB_PASSWORD:-smf}
# Dev-only: skip the password prompt cost for local connections.
POSTGRES_HOST_AUTH_METHOD: scram-sha-256
volumes:
- db-data:/var/lib/postgresql/data
- ./.docker/postgres/init:/docker-entrypoint-initdb.d:ro
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${DB_USER:-smf} -d ${DB_NAME:-smf}"]
interval: 3s
timeout: 3s
retries: 20
restart: unless-stopped
# Catches every mail the forum sends. Nothing leaves the machine.
mailpit:
image: axllent/mailpit:latest
ports:
- "${MAILPIT_PORT:-8025}:8025"
restart: unless-stopped
# Browse and query either database at http://localhost:8081. The server field
# is pre-filled with whichever engine the forum is using; type the other
# service name in to look at it instead.
adminer:
image: adminer:latest
ports:
- "${ADMINER_PORT:-8081}:8080"
environment:
# Service name, not engine name: mysql or postgres.
ADMINER_DEFAULT_SERVER: ${ADMINER_SERVER:-mysql}
ADMINER_DESIGN: dracula
depends_on:
- mysql
- postgres
restart: unless-stopped
volumes:
db-data:
mysql-data: