|
| 1 | +ARG BASE_IMAGE=php:apache-bullseye |
| 2 | + |
| 3 | + |
| 4 | +##### |
| 5 | +# Fetch composer latest build |
| 6 | +##### |
| 7 | +FROM composer:latest AS composer |
| 8 | + |
| 9 | +##### |
| 10 | +# Build main image |
| 11 | +##### |
| 12 | +FROM $BASE_IMAGE |
| 13 | + |
| 14 | +LABEL \ |
| 15 | + org.opencontainers.image.title="GLPI development environment" \ |
| 16 | + org.opencontainers.image.description="This container can be used to serve GLPI in a development environment." \ |
| 17 | + org.opencontainers.image.url="https://github.com/glpi-project/docker-images" \ |
| 18 | + org.opencontainers.image.source= "[email protected]:glpi-project/docker-images" |
| 19 | + |
| 20 | +RUN apt update \ |
| 21 | + \ |
| 22 | + # Install bz2 extension (for marketplace). |
| 23 | + && apt install --assume-yes --no-install-recommends --quiet libbz2-dev \ |
| 24 | + && docker-php-ext-install bz2 \ |
| 25 | + \ |
| 26 | + # Install exif extension. |
| 27 | + && docker-php-ext-install exif \ |
| 28 | + \ |
| 29 | + # Install GD PHP extension. |
| 30 | + && apt install --assume-yes --no-install-recommends --quiet libfreetype6-dev libjpeg-dev libpng-dev libwebp-dev \ |
| 31 | + && docker-php-ext-configure gd --with-freetype --with-jpeg --with-webp \ |
| 32 | + && docker-php-ext-install gd \ |
| 33 | + \ |
| 34 | + # Install intl PHP extension. |
| 35 | + && apt install --assume-yes --no-install-recommends --quiet libicu-dev \ |
| 36 | + && docker-php-ext-install intl \ |
| 37 | + \ |
| 38 | + # Install ldap PHP extension. |
| 39 | + && apt install --assume-yes --no-install-recommends --quiet libldap2-dev \ |
| 40 | + && docker-php-ext-configure ldap --with-libdir=lib/x86_64-linux-gnu/ \ |
| 41 | + && docker-php-ext-install ldap \ |
| 42 | + \ |
| 43 | + # Install memcached PHP extension. |
| 44 | + && apt install --assume-yes --no-install-recommends --quiet libmemcached-dev \ |
| 45 | + && pecl install memcached \ |
| 46 | + && docker-php-ext-enable memcached \ |
| 47 | + \ |
| 48 | + # Install mysqli PHP extension. |
| 49 | + && docker-php-ext-install mysqli \ |
| 50 | + \ |
| 51 | + # Install opcache PHP extension. |
| 52 | + && docker-php-ext-install opcache \ |
| 53 | + \ |
| 54 | + # Install pcntl PHP extension (required for composer-require-checker). |
| 55 | + && docker-php-ext-install pcntl \ |
| 56 | + \ |
| 57 | + # Install redis PHP extension. |
| 58 | + && pecl install redis \ |
| 59 | + && docker-php-ext-enable redis \ |
| 60 | + \ |
| 61 | + # Install Zip PHP extension. |
| 62 | + && apt install --assume-yes --no-install-recommends --quiet libzip-dev \ |
| 63 | + && docker-php-ext-install zip \ |
| 64 | + \ |
| 65 | + # Install xdebug PHP extension. |
| 66 | + && pecl install xdebug \ |
| 67 | + && docker-php-ext-enable xdebug \ |
| 68 | + \ |
| 69 | + # Install XMLRPC PHP extension. |
| 70 | + # Install from Github (extension should be available on PECL but is not) |
| 71 | + && apt install --assume-yes --no-install-recommends --quiet libxml2-dev \ |
| 72 | + && mkdir -p /tmp/xmlrpc \ |
| 73 | + && (curl -LsfS https://github.com/php/pecl-networking-xmlrpc/archive/0f782ffe52cebd0a65356427b7ab72d48b72d20c/xmlrpc-0f782ff.tar.gz | tar xvz -C "/tmp/xmlrpc" --strip 1) \ |
| 74 | + && docker-php-ext-configure /tmp/xmlrpc --with-xmlrpc \ |
| 75 | + && docker-php-ext-install /tmp/xmlrpc \ |
| 76 | + && rm -rf /tmp/xmlrpc \ |
| 77 | + \ |
| 78 | + # Enable apache mods. |
| 79 | + && a2enmod rewrite \ |
| 80 | + \ |
| 81 | + # Install nodejs and npm. |
| 82 | + && apt install --assume-yes --no-install-recommends --quiet gnupg \ |
| 83 | + && mkdir -p /etc/apt/keyrings \ |
| 84 | + && curl --fail --silent --show-error --location https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor --output /etc/apt/keyrings/nodesource.gpg \ |
| 85 | + && echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_20.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list \ |
| 86 | + && apt update \ |
| 87 | + && apt install --assume-yes --no-install-recommends --quiet nodejs \ |
| 88 | + \ |
| 89 | + # Install git and zip used by composer when fetching dependencies. |
| 90 | + && apt install --assume-yes --no-install-recommends --quiet git unzip \ |
| 91 | + \ |
| 92 | + # Install gettext used for translation files. |
| 93 | + && apt install --assume-yes --no-install-recommends --quiet gettext \ |
| 94 | + \ |
| 95 | + # Install Cypress dependencies |
| 96 | + && apt install --assume-yes --no-install-recommends --quiet libgtk2.0-0 libgtk-3-0 libgbm-dev libnotify-dev libnss3 libxss1 libasound2 libxtst6 xauth xvfb \ |
| 97 | + \ |
| 98 | + # Install dependencies for plugin release tool |
| 99 | + && apt install --assume-yes --no-install-recommends --quiet gpg python3 python3-git python3-gitdb python3-github python3-lxml python3-termcolor \ |
| 100 | + && ln -s /usr/bin/python3 /usr/bin/python \ |
| 101 | + \ |
| 102 | + # Install transifex client |
| 103 | + && (cd /usr/local/bin/ && curl --silent --location https://raw.githubusercontent.com/transifex/cli/master/install.sh | bash) \ |
| 104 | + \ |
| 105 | + # Install misc util packages commonly used by developers |
| 106 | + && apt install --assume-yes --no-install-recommends --quiet htop nano sudo vim zsh \ |
| 107 | + \ |
| 108 | + # Clean sources list |
| 109 | + && rm -rf /var/lib/apt/lists/* |
| 110 | + |
| 111 | +# Copy composer binary |
| 112 | +COPY --from=composer /usr/bin/composer /usr/bin/composer |
| 113 | + |
| 114 | +# Copy default PHP development configuration |
| 115 | +RUN cp "$PHP_INI_DIR/php.ini-development" "$PHP_INI_DIR/php.ini" |
| 116 | + |
| 117 | +# Copy files to container. |
| 118 | +COPY ./files/etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/000-default.conf |
| 119 | +COPY ./files/etc/php/conf.d/glpi.ini $PHP_INI_DIR/conf.d/glpi.ini |
| 120 | + |
| 121 | +# Define GLPI environment variables |
| 122 | +ENV \ |
| 123 | + GLPI_ENVIRONMENT_TYPE=development |
| 124 | + |
| 125 | +USER www-data |
| 126 | +WORKDIR /var/www/glpi |
0 commit comments