Mise à jour
Séparation de l'environnement de build pour consommer moins d'espace lors de la construction d'une nouvelle image.
This commit is contained in:
parent
163cc74b50
commit
c2be36c3b1
6
alpine/.gitignore
vendored
Normal file
6
alpine/.gitignore
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
db/
|
||||
etc/
|
||||
files/
|
||||
log/
|
||||
backup/
|
||||
mysql_settings.ini
|
@ -1,59 +0,0 @@
|
||||
FROM alpine
|
||||
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 \
|
||||
apk add \
|
||||
runit \
|
||||
php7-apache2 \
|
||||
php7 \
|
||||
mariadb-client \
|
||||
php7-pecl-apcu \
|
||||
php7-mysqli \
|
||||
php7-gd \
|
||||
php7-intl \
|
||||
php7-ldap \
|
||||
php7-xmlrpc \
|
||||
php7-exif \
|
||||
php7-zip \
|
||||
php7-bz2 \
|
||||
php7-opcache \
|
||||
php7-pear \
|
||||
php7-curl \
|
||||
php7-dom \
|
||||
php7-pdo \
|
||||
php7-json \
|
||||
php7-session \
|
||||
php7-ctype \
|
||||
php7-fileinfo \
|
||||
php7-mbstring \
|
||||
php7-simplexml \
|
||||
php7-iconv \
|
||||
php7-sodium \
|
||||
php7-phar
|
||||
|
||||
COPY CAS-1.3.8.tgz /root/
|
||||
RUN pear install /root/CAS-1.3.8.tgz && \
|
||||
pear install Archive_Tar
|
||||
COPY httpd.conf /etc/apache2
|
||||
COPY service/ /etc/service/
|
||||
COPY glpi_init.sh /root/glpi_init.sh
|
||||
COPY glpi.cron /var/spool/cron/crontabs/apache
|
||||
COPY initrc /etc/
|
||||
COPY glpi_ticket.class.php.patch /root/
|
||||
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 /etc/initrc && \
|
||||
chmod 600 /etc/crontabs/apache && \
|
||||
rm -f /var/www/html/* /root/CAS-1.3.8.tgz && \
|
||||
rm -rf /tmp/* /var/tmp/*
|
||||
|
||||
ENTRYPOINT ["/etc/initrc"]
|
@ -1,4 +1,8 @@
|
||||
Ajouter un fichier mysql_settings.ini qui contient
|
||||
|
||||
```
|
||||
MYSQL_DATABASE=
|
||||
MYSQL_USER=
|
||||
MYSQL_PASSWORD=''
|
||||
MYSQL_ROOT_PASSWORD=''
|
||||
```
|
@ -2,21 +2,24 @@ version: '3.5'
|
||||
services:
|
||||
web:
|
||||
container_name: glpi-web
|
||||
build: .
|
||||
build: web-builder
|
||||
restart: always
|
||||
ports:
|
||||
- 8089:80
|
||||
volumes:
|
||||
- ./etc/:/etc/glpi/
|
||||
- ./files/:/var/lib/glpi/
|
||||
- ./log/:/var/log/glpi/
|
||||
env_file:
|
||||
- ./mysql_settings.ini
|
||||
environment:
|
||||
- PHP_MEMORY_LIMIT=256M
|
||||
- PHP_UPLOAD_MAX_FILESIZE=10M
|
||||
- PHP_POST_MAX_SIZE=20M
|
||||
- PHP_DATE_TIMEZONE=Europe/Paris
|
||||
depends_on:
|
||||
- db
|
||||
|
||||
db:
|
||||
image: mysql:5.7
|
||||
image: mariadb
|
||||
container_name: glpi-db
|
||||
command: --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci
|
||||
restart: always
|
||||
|
83
alpine/web-builder/Dockerfile
Normal file
83
alpine/web-builder/Dockerfile
Normal file
@ -0,0 +1,83 @@
|
||||
FROM alpine
|
||||
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.5
|
||||
ENV FUSIONINVENTORY_VERSION=9.5+3.0
|
||||
ENV FIELDS_VERSION=1.12.4
|
||||
ENV DATAINJECTION_VERSION=2.9.0
|
||||
|
||||
RUN \
|
||||
apk add --no-cache \
|
||||
runit \
|
||||
php7-apache2 \
|
||||
php7 \
|
||||
mariadb-client \
|
||||
php7-pecl-apcu \
|
||||
php7-mysqli \
|
||||
php7-gd \
|
||||
php7-intl \
|
||||
php7-ldap \
|
||||
php7-xmlrpc \
|
||||
php7-xml \
|
||||
php7-exif \
|
||||
php7-zip \
|
||||
php7-bz2 \
|
||||
php7-opcache \
|
||||
php7-pear \
|
||||
php7-curl \
|
||||
php7-dom \
|
||||
php7-pdo \
|
||||
php7-json \
|
||||
php7-session \
|
||||
php7-ctype \
|
||||
php7-fileinfo \
|
||||
php7-mbstring \
|
||||
php7-simplexml \
|
||||
php7-iconv \
|
||||
php7-sodium \
|
||||
php7-imap \
|
||||
php7-pdo \
|
||||
php7-pdo_mysql \
|
||||
php7-pspell \
|
||||
php7-phar \
|
||||
patch
|
||||
|
||||
COPY CAS-1.3.8.tgz /root/
|
||||
RUN pear install /root/CAS-1.3.8.tgz && \
|
||||
pear install Archive_Tar
|
||||
COPY httpd.conf /etc/apache2
|
||||
COPY service/ /etc/service/
|
||||
COPY glpi_init.sh /root/glpi_init.sh
|
||||
COPY glpi.cron /var/spool/cron/crontabs/apache
|
||||
COPY initrc /etc/
|
||||
COPY glpi_ticket.class.php.patch /root/glpi_ticket.class.php.patch
|
||||
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
|
||||
ADD https://github.com/pluginsGLPI/fields/releases/download/${FIELDS_VERSION}/glpi-fields-${FIELDS_VERSION}.tar.bz2 /root/glpi-fields-${FIELDS_VERSION}.tar.bz2
|
||||
ADD https://github.com/pluginsGLPI/datainjection/releases/download/${DATAINJECTION_VERSION}/glpi-datainjection-${DATAINJECTION_VERSION}.tar.bz2 /root/glpi-datainjection-${DATAINJECTION_VERSION}.tar.bz2
|
||||
|
||||
RUN \
|
||||
mkdir -p /root/glpi_template/etc /root/glpi_template/files && \
|
||||
tar x -f /root/glpi-${GLPI_VERSION}.tgz && \
|
||||
cp -r /root/glpi/config/. /root/glpi_template/etc/. && \
|
||||
cp -r /root/glpi/files/. /root/glpi_template/files/. && \
|
||||
rm -r /root/glpi/config /root/glpi/files && \
|
||||
mv /root/glpi /var/www/glpi && \
|
||||
cd /var/www/glpi && \
|
||||
patch -Np0 -i /root/glpi_ticket.class.php.patch && \
|
||||
cd /var/www/glpi/plugins && \
|
||||
tar x -f /root/fusioninventory-${FUSIONINVENTORY_VERSION}.tar.bz2 && \
|
||||
cd /var/www/glpi/marketplace && \
|
||||
tar x -f /root/glpi-fields-${FIELDS_VERSION}.tar.bz2 && \
|
||||
tar x -f /root/glpi-datainjection-${DATAINJECTION_VERSION}.tar.bz2 && \
|
||||
chmod a+x /root/glpi_init.sh /etc/initrc && \
|
||||
chmod 600 /etc/crontabs/apache && \
|
||||
rm -f /var/www/html/* /root/CAS-1.3.8.tgz /root/glpi-${GLPI_VERSION}.tgz /root/fusioninventory-${FUSIONINVENTORY_VERSION}.tar.bz2 /root/glpi-fields-${FIELDS_VERSION}.tar.bz2 /root/glpi-datainjection-${DATAINJECTION_VERSION}.tar.bz2 && \
|
||||
rm -f /root/glpi_ticket.class.php.patch && \
|
||||
rm -rf /tmp/* /var/tmp/*
|
||||
|
||||
ENTRYPOINT ["/etc/initrc"]
|
@ -3,3 +3,4 @@ GLPI_VAR_DIR=/var/lib/glpi
|
||||
GLPI_LOG_DIR=/var/log/glpi
|
||||
|
||||
*/1 * * * * /usr/bin/php7 /var/www/glpi/front/cron.php
|
||||
0 * * * * cd /var/www/glpi && php bin/console glpi:ldap:synchronize_users -n
|
@ -1,6 +1,4 @@
|
||||
#!/bin/sh
|
||||
GLPI_TARBALL="/root/glpi-9.5.1.tgz"
|
||||
FUSION_TARBALL="/root/fusioninventory-9.5.0+1.0.tar.bz2"
|
||||
NORMAL=''
|
||||
RED=''
|
||||
GREEN=''
|
||||
@ -28,19 +26,33 @@ while ! mysqlshow -h db -uroot -p${MYSQL_ROOT_PASSWORD} 2>&1 | grep "^| ${MYSQL_
|
||||
done
|
||||
}
|
||||
|
||||
updatephpini() {
|
||||
variable=$1
|
||||
value=$2
|
||||
file="/etc/php7/php.ini"
|
||||
|
||||
if [ ! -z "${value}" ] ; then
|
||||
msglog green "Updating $variable to $value in $file"
|
||||
if grep "^${variable}" "${file}" > /dev/null 2<&1 ; then
|
||||
sed -i "s@^\(${variable}\s*=\).*@\1 ${value}@g" "${file}"
|
||||
else
|
||||
echo ${variable} = ${value} >> ${file}
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
updatephpini memory_limit ${PHP_MEMORY_LIMIT}
|
||||
updatephpini upload_max_filesize ${PHP_UPLOAD_MAX_FILESIZE}
|
||||
updatephpini post_max_size ${PHP_POST_MAX_SIZE}
|
||||
updatephpini date.timezone ${PHP_DATE_TIMEZONE}
|
||||
|
||||
mkdir -p /var/www/glpi
|
||||
if [ -z "$(ls -A /var/www/glpi)" ] ; then
|
||||
if [ ! -e "/etc/glpi/config_db.php" ] ; 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/glpi/.
|
||||
cd /var/www/glpi/plugins
|
||||
tar xf ${FUSION_TARBALL}
|
||||
rm -r /root/glpi
|
||||
cp -r /root/glpi_template/etc/. /etc/glpi/.
|
||||
cp -r /root/glpi_template/files/. /var/lib/glpi/.
|
||||
mysql --host=db --user=root --password=${MYSQL_ROOT_PASSWORD} << EOF
|
||||
use mysql;
|
||||
GRANT SELECT ON time_zone_name TO '${MYSQL_USER}'@'%';
|
||||
@ -52,31 +64,32 @@ EOF
|
||||
rm install/install.php
|
||||
chown -R apache:apache /var/www/glpi /etc/glpi /var/lib/glpi /var/log/glpi
|
||||
patch -Np0 -i /root/glpi_ticket.class.php.patch
|
||||
echo "${GLPI_VERSION}" > /etc/glpi/glpi_actual_version
|
||||
echo "${FUSIONINVENTORY_VERSION}" > /etc/glpi/fusioninventory_actual_version
|
||||
echo "${FIELDS_VERSION}" > /etc/glpi/fields_actual_version
|
||||
echo "${DATAINJECTION_VERSION}" > /etc/glpi/datainjection_version
|
||||
msglog green "Initialazing complete..."
|
||||
else
|
||||
msglog green "GLPI is already initialized"
|
||||
cd /var/www/glpi
|
||||
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
|
||||
GLPI_ACTUAL_VERSION=$(cat /etc/glpi/glpi_actual_version)
|
||||
FUSIONINVENTORY_ACTUAL_VERSION=$(cat /etc/glpi/fusioninventory_actual_version)
|
||||
FIELDS_ACTUAL_VERSION=$(cat /etc/glpi/fields_actual_version)
|
||||
DATAINJECTION_ACTUAL_VERSION=$(cat /etc/glpi/datainjection_version)
|
||||
if [ "${GLPI_ACTUAL_VERSION}" = "${GLPI_VERSION}" -a "${FUSIONINVENTORY_ACTUAL_VERSION}" = "${FUSIONINVENTORY_VERSION}" -a "${FIELDS_ACTUAL_VERSION}" = "${FIELDS_VERSION}" -a "${DATAINJECTION_ACTUAL_VERSION}" = "${DATAINJECTION_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/glpi
|
||||
mv glpi /var/www/glpi
|
||||
cd /var/www/glpi/plugins
|
||||
tar xf ${FUSION_TARBALL}
|
||||
rm /var/www/glpi/install/install.php
|
||||
cd /var/www/glpi
|
||||
php bin/console db:update --config-dir=${GLPI_CONFIG_DIR} -n
|
||||
php bin/console glpi:maintenance:enable -n
|
||||
php bin/console glpi:plugin:deactivate --all -n
|
||||
rm /var/www/glpi/install/install.php
|
||||
php bin/console db:update --config-dir=${GLPI_CONFIG_DIR} -n && \
|
||||
( echo "${GLPI_VERSION}" > /etc/glpi/glpi_actual_version ; \
|
||||
echo "${FUSIONINVENTORY_VERSION}" > /etc/glpi/fusioninventory_actual_version ; \
|
||||
echo "${FIELDS_VERSION}" > /etc/glpi/fields_actual_version ; \
|
||||
echo "${DATAINJECTION_VERSION}" > /etc/glpi/datainjection_actual_version )
|
||||
php bin/console glpi:maintenance:disable -n
|
||||
chown -R apache:apache /var/www/glpi /etc/glpi /var/lib/glpi /var/log/glpi
|
||||
patch -Np0 -i /root/glpi_ticket.class.php.patch
|
||||
|
||||
fi
|
0
alpine/service/20-cron/run → alpine/web-builder/service/20-cron/run
Executable file → Normal file
0
alpine/service/20-cron/run → alpine/web-builder/service/20-cron/run
Executable file → Normal file
0
alpine/service/30-apache2/run → alpine/web-builder/service/30-apache2/run
Executable file → Normal file
0
alpine/service/30-apache2/run → alpine/web-builder/service/30-apache2/run
Executable file → Normal file
0
alpine/service/90-glpi_init/run → alpine/web-builder/service/90-glpi_init/run
Executable file → Normal file
0
alpine/service/90-glpi_init/run → alpine/web-builder/service/90-glpi_init/run
Executable file → Normal file
7331
alpine/web-builder/ticket.class.php
Normal file
7331
alpine/web-builder/ticket.class.php
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user