-
-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathdocker-compose.adminer.yaml
More file actions
83 lines (80 loc) · 2.87 KB
/
docker-compose.adminer.yaml
File metadata and controls
83 lines (80 loc) · 2.87 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
#ddev-generated
services:
adminer:
container_name: ddev-${DDEV_SITENAME}-adminer
image: ${ADMINER_DOCKER_IMAGE:-adminer:standalone}
environment:
- ADMINER_DEFAULT_DRIVER=${ADMINER_DEFAULT_DRIVER:-${DDEV_DATABASE_FAMILY:-server}}
- ADMINER_DEFAULT_SERVER=${ADMINER_DEFAULT_SERVER:-db}
- ADMINER_DEFAULT_DB=${ADMINER_DEFAULT_DB:-db}
- ADMINER_DEFAULT_USERNAME=${ADMINER_DEFAULT_USERNAME:-db}
- ADMINER_DEFAULT_PASSWORD=${ADMINER_DEFAULT_PASSWORD:-db}
- ADMINER_PLUGINS=${ADMINER_PLUGINS:-tables-filter}
- ADMINER_DESIGN=${ADMINER_DESIGN:-}
- VIRTUAL_HOST=$DDEV_HOSTNAME
- HTTP_EXPOSE=9100:8080
- HTTPS_EXPOSE=9101:8080
labels:
com.ddev.site-name: ${DDEV_SITENAME}
com.ddev.approot: $DDEV_APPROOT
volumes:
- ".:/mnt/ddev_config"
- "ddev-global-cache:/mnt/ddev-global-cache"
depends_on:
- db
command: ["php", "-S", "[::]:8080", "-t", "/var/www/html", "ddev-adminer.php"]
configs:
- source: ddev-adminer.php
target: /var/www/html/ddev-adminer.php
mode: "0444"
- source: entrypoint.sh
target: /usr/local/bin/entrypoint.sh
mode: "0755"
configs:
ddev-adminer.php:
content: |
<?php
// Let static files be served directly
$$uri = parse_url($$_SERVER['REQUEST_URI'], PHP_URL_PATH);
if (is_file('/var/www/html' . $$uri)) {
return false;
}
if (!count($$_GET)) {
if ($$_ENV['ADMINER_DEFAULT_DRIVER'] === 'mysql') {
$$_ENV['ADMINER_DEFAULT_DRIVER'] = 'server';
} else if ($$_ENV['ADMINER_DEFAULT_DRIVER'] === 'postgres') {
$$_ENV['ADMINER_DEFAULT_DRIVER'] = 'pgsql';
}
$$_POST['auth'] = [
'driver' => $$_ENV['ADMINER_DEFAULT_DRIVER'],
'server' => $$_ENV['ADMINER_DEFAULT_SERVER'],
'db' => $$_ENV['ADMINER_DEFAULT_DB'],
'username' => $$_ENV['ADMINER_DEFAULT_USERNAME'],
'password' => $$_ENV['ADMINER_DEFAULT_PASSWORD'],
];
}
include './index.php';
?>
entrypoint.sh:
content: |
#!/bin/sh
set -e
if [ -n "$$ADMINER_DESIGN" ]; then
# Only create link on initial start, to ensure that explicit changes to
# adminer.css after the container was started once are preserved.
if [ ! -e .adminer-init ]; then
for css_file in adminer.css adminer-dark.css; do
if [ -f "designs/$$ADMINER_DESIGN/$$css_file" ]; then
ln -sf "designs/$$ADMINER_DESIGN/$$css_file" adminer.css
break
fi
done
fi
fi
number=1
for PLUGIN in $$ADMINER_PLUGINS; do
php plugin-loader.php "$$PLUGIN" > plugins-enabled/$$(printf "%03d" $$number)-$$PLUGIN.php
number=$$(($$number+1))
done
touch .adminer-init || true
exec "$$@"