irongit
dockerweb/docker-entrypoint.sh
32 lines822 BBourne Again Shell (bash)
1#!/bin/sh
2
3# take care of postgres business
4su -s /bin/sh postgres <<EOF
5cd
6if [ ! -d data ];then
7 echo 'No data found, initializing postgres.'
8 mkdir data
9 chmod 700 data
10 initdb -D data > /dev/null 2> /dev/null
11 echo "host all all 0.0.0.0/0 md5" >> /var/lib/postgresql/data/pg_hba.conf
12 echo "listen_addresses='*'" >> /var/lib/postgresql/data/postgresql.conf
13 sed -i '/unix_socket_directories/d' /var/lib/postgresql/data/postgresql.conf
14 echo 'Postgres initialized'
15fi
16pg_ctl start -D /var/lib/postgresql/data > /dev/null
17echo 'Postgres Ready'
18EOF
19
20# take care of nginx business
21if [ ! "$(ls /etc/nginx)" ];then
22 echo 'Moving sample into nginx'
23 cp -r /sample/nginx/* /etc/nginx
24fi
25nginx
26tail -f /var/log/nginx/access.log &
27
28# take care of redis
29redis-server > /dev/null &
30
31# run the cmd
32$@