commit e7ec47a6fa1a012222713b59234e8c5650488177 Author: root Date: Mon Aug 3 21:32:39 2020 +0200 Début du projet diff --git a/CAS-1.3.8.tgz b/CAS-1.3.8.tgz new file mode 100644 index 0000000..eb5c0ee Binary files /dev/null and b/CAS-1.3.8.tgz differ diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..a064e44 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,48 @@ +FROM php:7.4-apache-buster +MAINTAINER Benoit LORAND + +WORKDIR /root + +RUN \ +apt-get update && \ +apt-get install --no-install-recommends -y \ + supervisor \ + cron \ + libbz2-dev \ + libzip-dev \ + libxml2-dev \ + libldap2-dev \ + libicu-dev \ + libpng-dev \ + zlib1g-dev \ + && \ +pecl install apcu && docker-php-ext-enable apcu && \ +docker-php-ext-configure mysqli && docker-php-ext-install mysqli && \ +docker-php-ext-configure gd && docker-php-ext-install gd && \ +docker-php-ext-configure intl && docker-php-ext-install intl && \ +docker-php-ext-configure ldap && docker-php-ext-install ldap && \ +docker-php-ext-configure xmlrpc && docker-php-ext-install xmlrpc && \ +docker-php-ext-configure exif && docker-php-ext-install exif && \ +docker-php-ext-configure zip && docker-php-ext-install zip && \ +docker-php-ext-configure bz2 && docker-php-ext-install bz2 && \ +docker-php-ext-configure opcache && docker-php-ext-install opcache + +ADD CAS-1.3.8.tgz /root +RUN pear install /root/CAS-1.3.8.tgz +ADD supervisor/supervisord.conf /etc/supervisor +ADD supervisor/conf.d/apache2.conf /etc/supervisor/conf.d +ADD supervisor/conf.d/cron.conf /etc/supervisor/conf.d +ADD supervisor/conf.d/glpi_init.conf /etc/supervisor/conf.d +ADD glpi_init.sh /root/glpi_init.sh +ADD glpi.cron /etc/cron.d/glpi +ADD https://github.com/glpi-project/glpi/releases/download/9.5.0/glpi-9.5.0.tgz /root/glpi-9.5.0.tgz +ADD https://github.com/fusioninventory/fusioninventory-for-glpi/releases/download/glpi9.5.0%2B1.0/fusioninventory-9.5.0+1.0.tar.bz2 /root/fusioninventory-9.5.0+1.0.tar.bz2 + +RUN \ +chmod a+x /root/glpi_init.sh && \ +rm -f /var/www/html/* /root/CAS-1.3.8.tgz && \ +apt-get clean && \ +rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* + +ENTRYPOINT ["supervisord", "--nodaemon", "--configuration", "/etc/supervisor/supervisord.conf"] + diff --git a/README.md b/README.md new file mode 100644 index 0000000..e69de29 diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..0e46738 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,25 @@ +version: '3.5' +services: + web: + container_name: glpi-web + build: . + restart: always + ports: + - 8089:80 + volumes: + - ./www:/var/www/html + depends_on: + - db + + db: + image: mysql:5.7 + container_name: glpi-db + command: --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci + restart: always + environment: + MYSQL_DATABASE: mysql_db_name + MYSQL_USER: mysql_db_user + MYSQL_PASSWORD: mysql_db_password + MYSQL_RANDOM_ROOT_PASSWORD: '1' + volumes: + - ./db:/var/lib/mysql diff --git a/glpi.cron b/glpi.cron new file mode 100644 index 0000000..bf60a6d --- /dev/null +++ b/glpi.cron @@ -0,0 +1 @@ +* * * * * root /usr/local/bin/php /var/www/html/front/cron.php &>/dev/null diff --git a/glpi_init.sh b/glpi_init.sh new file mode 100644 index 0000000..e1d8e88 --- /dev/null +++ b/glpi_init.sh @@ -0,0 +1,16 @@ +#!/bin/sh +GLPI_TARBALL="/root/glpi-9.5.0.tgz" +FUSION_TARBALL="/root/fusioninventory-9.5.0+1.0.tar.bz2" + +if [ -z $(ls -A /var/www/html) ] ; then + echo "Initilazing ${GLPI_TARBALL}" + cd /root + tar xf ${GLPI_TARBALL} + cp -r /root/glpi/. /var/www/html/. + cd /var/www/html/plugins + tar xf ${FUSION_TARBALL} + chown -R www-data:www-data /var/www/html + rm -r /root/glpi +else + echo "GLPI is already initialized" +fi diff --git a/supervisor/conf.d/apache2.conf b/supervisor/conf.d/apache2.conf new file mode 100644 index 0000000..d2b3d6c --- /dev/null +++ b/supervisor/conf.d/apache2.conf @@ -0,0 +1,4 @@ +[program:apache2] +command=apache2-foreground +autostart=true +autorestart=true diff --git a/supervisor/conf.d/cron.conf b/supervisor/conf.d/cron.conf new file mode 100644 index 0000000..85f4a1b --- /dev/null +++ b/supervisor/conf.d/cron.conf @@ -0,0 +1,4 @@ +[program:cron] +command=cron -f -L 15 +autostart=true +autorestart=true diff --git a/supervisor/conf.d/glpi_init.conf b/supervisor/conf.d/glpi_init.conf new file mode 100644 index 0000000..e4169a4 --- /dev/null +++ b/supervisor/conf.d/glpi_init.conf @@ -0,0 +1,5 @@ +[program:glpi_init] +command=/root/glpi_init.sh +startsecs = 0 +autorestart = false +startretries = 1 diff --git a/supervisor/supervisord.conf b/supervisor/supervisord.conf new file mode 100644 index 0000000..79e5836 --- /dev/null +++ b/supervisor/supervisord.conf @@ -0,0 +1,15 @@ +; supervisor config file + +[supervisord] +logfile=/var/log/supervisor/supervisord.log ; (main log file;default $CWD/supervisord.log) +pidfile=/var/run/supervisord.pid ; (supervisord pidfile;default supervisord.pid) +childlogdir=/var/log/supervisor ; ('AUTO' child log dir, default $TEMP) + +; The [include] section can just contain the "files" setting. This +; setting can list multiple files (separated by whitespace or +; newlines). It can also contain wildcards. The filenames are +; interpreted as relative to this file. Included files *cannot* +; include files themselves. + +[include] +files = /etc/supervisor/conf.d/*.conf