Add cron to Dockerfile install. Change glpi-start.sh to add cron file to

the right directory and start cron at start before apache2ctl
pull/9/head
Drouin Amaury 8 years ago
parent 870a041ae7
commit 3b2f81ab30

@ -21,7 +21,8 @@ php-gd \
php-mbstring \ php-mbstring \
php-xml \ php-xml \
php-apcu-bc \ php-apcu-bc \
wget wget \
cron
#Copie et execution du script pour l'installation et l'initialisation de GLPI #Copie et execution du script pour l'installation et l'initialisation de GLPI
COPY glpi-start.sh /opt/ COPY glpi-start.sh /opt/

@ -0,0 +1,21 @@
version: "2"
services:
#GLPI Container
glpi:
build: ./
image: myglpi
container_name : myglpi
ports:
- "9080:80"
links:
- mysql:mysql
restart: always
#Mysql Container
mysql:
image: mysql
container_name: mysql
hostname: mysql
env_file:
- ./mysql.env

@ -1,36 +1,40 @@
version: "2"
services:
#Mysql Persitance Data #Mysql Persitance Data
mysql-data: mysql-data:
image: busybox image: busybox
container_name: mysql-data container_name: mysql-data
volumes: volumes:
- /var/lib/mysql:/var/lib/mysql - /var/lib/mysql:/var/lib/mysql
#Mysql Container #Mysql Container
mysql: mysql:
image: mysql image: mysql
container_name: mysql container_name: mysql
hostname: mysql hostname: mysql
volumes_from: volumes_from:
- mysql-data - mysql-data
env_file: env_file:
- ./mysql.env - ./mysql.env
#GLPI Pesitance Data #GLPI Pesitance Data
glpi-data: glpi-data:
image: busybox image: busybox
container_name: glpi-data container_name: glpi-data
volumes: volumes:
- /var/www/html/glpi:/var/www/html/glpi - /var/www/html/glpi:/var/www/html/glpi
#GLPI Container #GLPI Container
glpi: glpi:
image: diouxx/glpi build: ./
container_name : glpi image: myglpi
hostname: glpi container_name : myglpi
ports: hostname: glpi
- "80:80" ports:
links: - "80:80"
- mysql:mysql links:
volumes_from: - mysql:mysql
- glpi-data volumes_from:
restart: always - glpi-data
restart: always

@ -31,10 +31,10 @@ fi
echo -e "<VirtualHost *:80>\n\tDocumentRoot /var/www/html/glpi\n\n\t<Directory /var/www/html/glpi>\n\t\tAllowOverride All\n\t\tOrder Allow,Deny\n\t\tAllow from all\n\t</Directory>\n\n\tErrorLog /var/log/apache2/error-glpi.log\n\tLogLevel warn\n\tCustomLog /var/log/apache2/access-glpi.log combined\n</VirtualHost>" > /etc/apache2/sites-available/000-default.conf echo -e "<VirtualHost *:80>\n\tDocumentRoot /var/www/html/glpi\n\n\t<Directory /var/www/html/glpi>\n\t\tAllowOverride All\n\t\tOrder Allow,Deny\n\t\tAllow from all\n\t</Directory>\n\n\tErrorLog /var/log/apache2/error-glpi.log\n\tLogLevel warn\n\tCustomLog /var/log/apache2/access-glpi.log combined\n</VirtualHost>" > /etc/apache2/sites-available/000-default.conf
#Add scheduled task by cron #Add scheduled task by cron
echo "*/5 * * * * /usr/bin/php /var/www/html/glpi/front/cron.php &>/dev/null" >> /etc/cron echo "*/5 * * * * root /usr/bin/php /var/www/html/glpi/front/cron.php &>/dev/null" >> /etc/cron.d/glpicron
#Activation du module rewrite d'apache #Activation du module rewrite d'apache
a2enmod rewrite && service apache2 restart && service apache2 stop a2enmod rewrite && service apache2 restart && service apache2 stop
#Lancement du service apache au premier plan #Lancement du service apache au premier plan
/usr/sbin/apache2ctl -D FOREGROUND cron -f & /usr/sbin/apache2ctl -D FOREGROUND

Loading…
Cancel
Save