forked from btn441/docker-npmc
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdocker-compose.sh
144 lines (121 loc) · 2.44 KB
/
docker-compose.sh
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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
#!/bin/bash
CONTENT=$(cat <<EOF
version: '3.7'
services:
EOF
)
PHP_FPM=$(cat <<EOF
php-fpm:
#build:
#context: php-fpm
#dockerfile: Dockerfile
image: rocketfirm911/php-fpm:8.0
volumes:
- ../:/var/www:delegated
- ./php-fpm/php.ini:/usr/local/etc/php/conf.d/40-custom.ini:delegated
- ~/.ssh:/home/www-data/.ssh:delegated
EOF
)
NGINX=$(cat <<EOF
nginx:
image: nginx:alpine
volumes:
- ../:/var/www:delegated
- ./nginx/:/etc/nginx/conf.d:delegated
- ./nginx/vhosts:/etc/nginx/vhosts:delegated
- ./nginx/logs:/var/log/nginx:delegated
depends_on:
- php-fpm
EOF
)
MARIADB=$(cat <<EOF
mariadb:
image: yobasystems/alpine-mariadb
command: --default-authentication-plugin=mysql_native_password
environment:
- MYSQL_ROOT_PASSWORD=docker
EOF
)
POSTGRES=$(cat <<EOF
postgres:
image: postgres:13
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
volumes:
- ./postgres/datadir:/var/lib/postgresql/data
EOF
)
ADMINER=$(cat <<EOF
adminer:
image: adminer
environment:
- ADMINER_DESIGN=hever
volumes:
- ./adminer/adminer.css:/var/www/html/designs/hever/adminer.css:delegated
EOF
)
MONGO=$(cat <<EOF
mongo:
image: mvertes/alpine-mongo
environment:
MONGO_INITDB_ROOT_USERNAME: root
MONGO_INITDB_ROOT_PASSWORD: root
EOF
)
MONGO_EXPRESS=$(cat <<EOF
mongo-express:
image: mongo-express
environment:
ME_CONFIG_MONGODB_SERVER: mongo
ME_CONFIG_BASICAUTH_USERNAME: root
ME_CONFIG_BASICAUTH_PASSWORD: root
EOF
)
REDIS=$(cat <<EOF
redis:
image: redis:alpine
EOF
)
ELASTICSEARCH=$(cat <<EOF
elasticsearch:
image: elasticsearch:7.10.1
environment:
- discovery.type=single-node
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
EOF
)
for var in "$@"
do
if [ $var = 'php-fpm' ]
then
CONTENT+=$PHP_FPM
elif [ $var = 'nginx' ]
then
CONTENT+=$NGINX
elif [ $var = 'mariadb' ]
then
CONTENT+=$MARIADB
elif [ $var = 'postgres' ]
then
CONTENT+=$POSTGRES
elif [ $var = 'adminer' ]
then
CONTENT+=$ADMINER
elif [ $var = 'mongo' ]
then
CONTENT+=$MONGO
elif [ $var = 'mongo-express' ]
then
CONTENT+=$MONGO_EXPRESS
elif [ $var = 'redis' ]
then
CONTENT+=$REDIS
elif [ $var = 'elasticsearch' ]
then
CONTENT+=$ELASTICSEARCH
fi
done
cat <<EOF > docker-compose.yml
$CONTENT
EOF