Ajout de la version alpine
This commit is contained in:
BIN
debian/CAS-1.3.8.tgz
vendored
Normal file
BIN
debian/CAS-1.3.8.tgz
vendored
Normal file
Binary file not shown.
50
debian/Dockerfile
vendored
Normal file
50
debian/Dockerfile
vendored
Normal file
@ -0,0 +1,50 @@
|
||||
FROM php:7.4-apache-buster
|
||||
MAINTAINER Benoit LORAND <benoit.lorand@blorand.org>
|
||||
|
||||
WORKDIR /root
|
||||
ENV GLPI_CONFIG_DIR=/etc/glpi
|
||||
ENV GLPI_VAR_DIR=/var/lib/glpi
|
||||
ENV GLPI_LOG_DIR=/var/log/glpi
|
||||
ENV GLPI_VERSION=9.5.1
|
||||
ENV FUSIONINVENTORY_VERSION=9.5.0+1.0
|
||||
|
||||
RUN \
|
||||
apt-get update && \
|
||||
apt-get install --no-install-recommends -y \
|
||||
runit \
|
||||
cron \
|
||||
libbz2-dev \
|
||||
libzip-dev \
|
||||
libxml2-dev \
|
||||
libldap2-dev \
|
||||
libicu-dev \
|
||||
libpng-dev \
|
||||
zlib1g-dev \
|
||||
default-mysql-client \
|
||||
&& \
|
||||
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
|
||||
|
||||
COPY CAS-1.3.8.tgz /root/
|
||||
RUN pear install /root/CAS-1.3.8.tgz
|
||||
COPY service/ /etc/service/
|
||||
COPY glpi_init.sh /root/glpi_init.sh
|
||||
COPY glpi.cron /etc/cron.d/glpi
|
||||
ADD https://github.com/glpi-project/glpi/releases/download/${GLPI_VERSION}/glpi-${GLPI_VERSION}.tgz /root/glpi-${GLPI_VERSION}.tgz
|
||||
ADD https://github.com/fusioninventory/fusioninventory-for-glpi/releases/download/glpi${FUSIONINVENTORY_VERSION}/fusioninventory-${FUSIONINVENTORY_VERSION}.tar.bz2 /root/fusioninventory-${FUSIONINVENTORY_VERSION}.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 ["/usr/bin/runsvdir", "-P", "/etc/service"]
|
0
debian/README.md
vendored
Normal file
0
debian/README.md
vendored
Normal file
26
debian/docker-compose.yml
vendored
Normal file
26
debian/docker-compose.yml
vendored
Normal file
@ -0,0 +1,26 @@
|
||||
version: '3.5'
|
||||
services:
|
||||
web:
|
||||
container_name: glpi-web
|
||||
build: .
|
||||
restart: always
|
||||
ports:
|
||||
- 8089:80
|
||||
volumes:
|
||||
- ./etc/:/etc/glpi/
|
||||
- ./files/:/var/lib/glpi/
|
||||
- ./log/:/var/log/glpi/
|
||||
env_file:
|
||||
- ./mysql_settings.ini
|
||||
depends_on:
|
||||
- db
|
||||
|
||||
db:
|
||||
image: mariadb
|
||||
container_name: glpi-db
|
||||
command: --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci
|
||||
restart: always
|
||||
env_file:
|
||||
- ./mysql_settings.ini
|
||||
volumes:
|
||||
- ./db/:/var/lib/mysql/
|
5
debian/glpi.cron
vendored
Normal file
5
debian/glpi.cron
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
GLPI_CONFIG_DIR=/etc/glpi
|
||||
GLPI_VAR_DIR=/var/lib/glpi
|
||||
GLPI_LOG_DIR=/var/log/glpi
|
||||
|
||||
*/1 * * * * www-data /usr/local/bin/php /var/www/html/front/cron.php
|
79
debian/glpi_init.sh
vendored
Normal file
79
debian/glpi_init.sh
vendored
Normal file
@ -0,0 +1,79 @@
|
||||
#!/bin/sh
|
||||
GLPI_TARBALL="/root/glpi-9.5.1.tgz"
|
||||
FUSION_TARBALL="/root/fusioninventory-9.5.0+1.0.tar.bz2"
|
||||
NORMAL='\e[39m'
|
||||
RED='\e[31m'
|
||||
GREEN='\e[32m'
|
||||
|
||||
msglog() {
|
||||
case "${1}" in
|
||||
green)
|
||||
TEXT_COLOR="${GREEN}"
|
||||
;;
|
||||
red)
|
||||
TEXT_COLOR="${RED}"
|
||||
;;
|
||||
normal)
|
||||
TEXT_COLOR="${NORMAL}"
|
||||
;;
|
||||
esac
|
||||
DATE=$(date '+%Y %b %d %H:%M:%S')
|
||||
echo ${DATE} ${TEXT_COLOR}${2}${NORMAL}
|
||||
}
|
||||
|
||||
waiting_for_db() {
|
||||
while ! mysqlshow -h db -uroot -p${MYSQL_ROOT_PASSWORD} 2>&1 | grep "^| ${MYSQL_DATABASE}" > /dev/null 2>&1 ; do
|
||||
msglog red "Waiting for mysql database initilization..."
|
||||
sleep 5
|
||||
done
|
||||
}
|
||||
|
||||
|
||||
if [ -z "$(ls -A /var/www/html)" ] ; then
|
||||
waiting_for_db
|
||||
msglog red "Initialazing ${GLPI_TARBALL}..."
|
||||
cd /root
|
||||
tar xf ${GLPI_TARBALL}
|
||||
cp -r /root/glpi/config/. /etc/glpi/.
|
||||
cp -r /root/glpi/files/. /var/lib/glpi/.
|
||||
rm -r /root/glpi/config /root/glpi/files
|
||||
cp -r /root/glpi/. /var/www/html/.
|
||||
cd /var/www/html/plugins
|
||||
tar xf ${FUSION_TARBALL}
|
||||
rm -r /root/glpi
|
||||
mysql --host=db --user=root --password=${MYSQL_ROOT_PASSWORD} << EOF
|
||||
use mysql;
|
||||
GRANT SELECT ON time_zone_name TO '${MYSQL_USER}'@'%';
|
||||
EOF
|
||||
cd /var/www/html
|
||||
php bin/console db:install --config-dir=${GLPI_CONFIG_DIR} -L fr_FR -H db -d ${MYSQL_DATABASE} -u ${MYSQL_USER} -p ${MYSQL_PASSWORD} -n
|
||||
php bin/console glpi:plugin:install -u glpi fusioninventory -n
|
||||
php bin/console glpi:plugin:activate fusioninventory -n
|
||||
rm install/install.php
|
||||
chown -R www-data:www-data /var/www/html /etc/glpi /var/lib/glpi /var/log/glpi
|
||||
msglog green "Initialazing complete..."
|
||||
else
|
||||
msglog green "GLPI is already initialized"
|
||||
cd /var/www/html
|
||||
GLPI_ACTUAL_VERSION=$(awk -F", '" '/^define\(.GLPI_VERSION/ { print $2 }' inc/define.php | sed 's/\([0-9\.]*\).*/\1/')
|
||||
FUSIONINVENTORY_ACTUAL_VERSION=$(awk -F', "' '/^define \(.PLUGIN_FUSIONINVENTORY_VERSION/ { print $2 }' plugins/fusioninventory/setup.php | sed 's/\([0-9\.+]*\).*/\1/')
|
||||
if [ "${GLPI_ACTUAL_VERSION}" = "${GLPI_VERSION}" -a "${FUSIONINVENTORY_ACTUAL_VERSION}" = "${FUSIONINVENTORY_VERSION}" ] ; then
|
||||
msglog green "GLPI already up2date"
|
||||
exit
|
||||
fi
|
||||
msglog red "Updating GLPI from ${GLPI_ACTUAL_VERSION} to ${GLPI_VERSION}"
|
||||
waiting_for_db
|
||||
php bin/console glpi:maintenance:enable -n
|
||||
php bin/console glpi:plugin:deactivate fusioninventory -n
|
||||
cd /root
|
||||
tar xf ${GLPI_TARBALL}
|
||||
rm -r glpi/config glpi/files /var/www/html
|
||||
mv glpi /var/www/html
|
||||
cd /var/www/html/plugins
|
||||
tar xf ${FUSION_TARBALL}
|
||||
rm /var/www/html/install/install.php
|
||||
cd /var/www/html
|
||||
php bin/console db:update --config-dir=${GLPI_CONFIG_DIR} -n
|
||||
php bin/console glpi:maintenance:disable -n
|
||||
chown -R www-data:www-data /var/www/html /etc/glpi /var/lib/glpi /var/log/glpi
|
||||
fi
|
4
debian/mysql_settings.ini
vendored
Normal file
4
debian/mysql_settings.ini
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
MYSQL_DATABASE=
|
||||
MYSQL_USER=
|
||||
MYSQL_PASSWORD=''
|
||||
MYSQL_ROOT_PASSWORD=''
|
7
debian/service/20-cron/run
vendored
Executable file
7
debian/service/20-cron/run
vendored
Executable file
@ -0,0 +1,7 @@
|
||||
#!/bin/sh
|
||||
. /etc/service/template
|
||||
|
||||
msglog green "Starting Cron..."
|
||||
# Touch cron files to fix 'NUMBER OF HARD LINKS > 1' issue. See https://github.com/phusion/baseimage-docker/issues/198
|
||||
touch -c /etc/crontab /etc/cron.*/* /var/spool/cron/crontabs/*
|
||||
exec /usr/sbin/cron -f
|
5
debian/service/30-apache2/run
vendored
Executable file
5
debian/service/30-apache2/run
vendored
Executable file
@ -0,0 +1,5 @@
|
||||
#!/bin/sh
|
||||
. /etc/service/template
|
||||
|
||||
msglog green "Starting Apache..."
|
||||
exec apache2-foreground
|
6
debian/service/90-glpi_init/run
vendored
Executable file
6
debian/service/90-glpi_init/run
vendored
Executable file
@ -0,0 +1,6 @@
|
||||
#!/bin/sh
|
||||
. /etc/service/template
|
||||
|
||||
msglog green "Starting glpi_init.sh..."
|
||||
/root/glpi_init.sh
|
||||
sleep infinity
|
19
debian/service/template
vendored
Normal file
19
debian/service/template
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
NORMAL='\e[39m'
|
||||
RED='\e[31m'
|
||||
GREEN='\e[32m'
|
||||
|
||||
msglog() {
|
||||
case "${1}" in
|
||||
green)
|
||||
TEXT_COLOR="${GREEN}"
|
||||
;;
|
||||
red)
|
||||
TEXT_COLOR="${RED}"
|
||||
;;
|
||||
normal)
|
||||
TEXT_COLOR="${NORMAL}"
|
||||
;;
|
||||
esac
|
||||
DATE=$(date '+%Y %b %d %H:%M:%S')
|
||||
echo ${DATE} ${TEXT_COLOR}${2}${NORMAL}
|
||||
}
|
Reference in New Issue
Block a user