Skip to content

Commit 6f19684

Browse files
committed
Initial version based on docker-nginx-php-fpm instance
1 parent 4427b92 commit 6f19684

File tree

4 files changed

+71
-0
lines changed

4 files changed

+71
-0
lines changed

Dockerfile

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
FROM HouseOfAgile/docker-nginx-php-fpm:latest
2+
3+
MAINTAINER Meillaud Jean-Christophe ([email protected])
4+
5+
#Node install
6+
RUN add-apt-repository ppa:chris-lea/node.js
7+
RUN apt-get update
8+
9+
RUN apt-get install -y nodejs
10+
RUN npm install less -g
11+
RUN npm install -g bower
12+
13+
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/bin/
14+
RUN mv /usr/bin/composer.phar /usr/bin/composer
15+
16+
ADD ./config/projects /usr/share/nginx/
17+
RUN chown www-data -R /usr/share/nginx/
18+
19+
## Install SSH for a specific user (thanks to public key)
20+
ADD ./private/id_rsa.pub /tmp/your_key
21+
RUN cat /tmp/your_key >> /root/.ssh/authorized_keys && rm -f /tmp/your_key
22+
23+
# Add private key in order to get access to private repo
24+
ADD ./private/id_rsa /root/.ssh/id_rsa
25+
26+
RUN apt-get clean && rm -rf /tmp/* /var/tmp/*
27+
28+
ADD ./config/sm-config /root/.symfony-manager/sm-config
29+
30+
RUN mkdir -p /etc/my_init.d
31+
ADD setup-projects.sh /etc/my_init.d/setup-projects.sh
32+
33+
EXPOSE 80
34+
35+
CMD ["/sbin/my_init"]

set_env.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
export DOCKER_DB_INSTANCE=$(sudo docker ps | grep "beaudev/mysql" | nawk '{print $1}')
2+
export DB_PASS=$(sudo docker logs $DOCKER_DB_INSTANCE | grep "mysql -uadmin" | nawk '{print $3}' | sed 's/^-p//')
3+
export DB_HOST=`sudo docker inspect --format '{{ .NetworkSettings.IPAddress }}' $DOCKER_DB_INSTANCE`
4+
echo "Docker Mysql Instance:$DOCKER_DB_INSTANCE"
5+
echo -e "Docker Mysql Details:\n\thost : $DB_HOST\n\tadmin pass:$DB_PASS"

setup-projects.sh

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/bin/bash
2+
set -x
3+
SM_CONF_DIR=/root/.symfony-manager
4+
5+
source ~/.bash-profile.d/bash-profile
6+
7+
if [ ! -d /root/config/sm-config ]; then
8+
cp /root/config/sm-config $SM_CONF_DIR/sm-config
9+
10+
for file in `ls $SM_CONF_DIR/sm-config`
11+
do
12+
source $SM_CONF_DIR/sm-config/$file
13+
cat /tmp/default-symfony-nginx.conf | sed "s/__project_name__/$application_projectname/g;s#__project_path__#$application_install_path#g;s/__project_hosts__/$application_host=/g" > /etc/nginx/sites-available/project_$application_projectname.conf
14+
ln -s /etc/nginx/sites-available/project_$application_projectname.conf /etc/nginx/sites-enabled/project_$application_projectname.conf
15+
project_name=${file/sm-config-}
16+
# $SM_CONF_DIR/symfony_manager.sh -l $SM_CONF_DIR/sm-config/$file -fi
17+
mkdir -p $application_install_path
18+
done
19+
fi

update_sm_files.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/bin/bash
2+
3+
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
4+
5+
DB_HOST=${DB_HOST:-127.0.0.1}
6+
DB_USER=${DB_USER:-admin}
7+
DB_PASS=${DB_PASS:-pass}
8+
9+
for file in `find $DIR/config/projects -type f | grep -v orig`
10+
do
11+
sed 's/###DB_HOST###/'$DB_HOST'/g;s/###DB_USER###/'$DB_USER'/g;s/###DB_PASS###/'$DB_PASS'/g' < ${file}.orig > ${file}
12+
done

0 commit comments

Comments
 (0)