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