Add scripts to make docker easier

This commit is contained in:
Karl Cordes 2018-12-16 14:23:18 +11:00
parent d0f5318984
commit 2b8ccf0492
5 changed files with 15 additions and 2 deletions

View file

@ -19,6 +19,7 @@ RUN DEBIAN_FRONTEND=noninteractive apt-get -y install apache2 libapache2-mod-php
#RUN php5enmod openssl #RUN php5enmod openssl
RUN a2enmod php5 RUN a2enmod php5
RUN a2enmod rewrite RUN a2enmod rewrite
RUN a2enmod headers
# Update the PHP.ini file, enable <? ?> tags and quieten logging. # Update the PHP.ini file, enable <? ?> tags and quieten logging.
RUN sed -i "s/short_open_tag = Off/short_open_tag = On/" /etc/php5/apache2/php.ini RUN sed -i "s/short_open_tag = Off/short_open_tag = On/" /etc/php5/apache2/php.ini
@ -34,10 +35,12 @@ ENV APACHE_PID_FILE /var/run/apache2.pid
EXPOSE 80 EXPOSE 80
# Copy site into place. # Copy site into place.
#ADD app /var/www/site/app ADD . /var/www/cmc-sales
# Update the default apache site with the config we created. # Update the default apache site with the config we created.
#ADD apache-config.conf /etc/apache2/sites-enabled/000-default.conf ADD conf/apache-vhost.conf /etc/apache2/sites-available/cmc-sales
RUN a2dissite 000-default
RUN a2ensite cmc-sales
# By default, simply start apache. # By default, simply start apache.
CMD /usr/sbin/apache2ctl -D FOREGROUND CMD /usr/sbin/apache2ctl -D FOREGROUND

3
build_docker.sh Normal file
View file

@ -0,0 +1,3 @@
ID=$(docker ps -f ancestor=cmc:latest -q)
docker kill $ID
docker build . -t "cmc:latest"

1
deploy.sh Normal file
View file

@ -0,0 +1 @@
ansible-playbook -i ../cmc-playbooks/inventory.txt ../cmc-playbooks/deploy.yml

2
enter_docker.sh Normal file
View file

@ -0,0 +1,2 @@
ID=$(docker ps -f ancestor=cmc:latest -q)
docker exec -it $ID /bin/bash

4
run_docker.sh Normal file
View file

@ -0,0 +1,4 @@
ID=$(docker ps -f ancestor=cmc:latest -q)
docker kill $ID
sleep 1
docker run -d -p 8888:80 --env-file environment_vars cmc:latest