From 46e4947f629646bc0d730d93ab18116d6aa1b783 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Anne?= Date: Thu, 8 Feb 2024 09:47:31 +0100 Subject: [PATCH] Replace `alpine` by `debian` for GLPI CI images --- .github/workflows/githubactions-php.yml | 6 +-- githubactions-glpi/Dockerfile | 2 +- githubactions-php-coverage/Dockerfile | 16 +----- githubactions-php/Dockerfile | 65 ++++++++++--------------- 4 files changed, 31 insertions(+), 58 deletions(-) diff --git a/.github/workflows/githubactions-php.yml b/.github/workflows/githubactions-php.yml index d328c8e..335bf8e 100644 --- a/.github/workflows/githubactions-php.yml +++ b/.github/workflows/githubactions-php.yml @@ -23,9 +23,9 @@ jobs: fail-fast: false matrix: include: - - {base-image: "php:8.1-fpm-alpine3.19", php-version: "8.1"} - - {base-image: "php:8.2-fpm-alpine3.19", php-version: "8.2"} - - {base-image: "php:8.3-fpm-alpine3.19", php-version: "8.3"} + - {base-image: "php:8.1-fpm-bullseye", php-version: "8.1"} + - {base-image: "php:8.2-fpm-bullseye", php-version: "8.2"} + - {base-image: "php:8.3-fpm-bullseye", php-version: "8.3"} steps: - name: "Set variables" run: | diff --git a/githubactions-glpi/Dockerfile b/githubactions-glpi/Dockerfile index 94e6626..4f77735 100644 --- a/githubactions-glpi/Dockerfile +++ b/githubactions-glpi/Dockerfile @@ -14,7 +14,7 @@ USER root # Create a user with UID=1001 (the UID used by Github Actions runner) and give it ownership of the `/var/glpi` directory, # so it can checkout the plugin and create config/user files without ACL issues. -RUN adduser -D -h /home/github-actions-runner -G glpi -u 1001 github-actions-runner \ +RUN useradd -m -d /home/github-actions-runner -g glpi -u 1001 github-actions-runner \ && chown -R github-actions-runner:glpi /var/glpi USER github-actions-runner diff --git a/githubactions-php-coverage/Dockerfile b/githubactions-php-coverage/Dockerfile index 6124d69..cff24a2 100644 --- a/githubactions-php-coverage/Dockerfile +++ b/githubactions-php-coverage/Dockerfile @@ -11,21 +11,9 @@ LABEL \ USER root RUN \ - # Update APK package list. - apk update \ - \ - # Install PHP build dependencies. - && apk add --virtual .build-deps $PHPIZE_DEPS linux-headers \ - \ # Install xdebug extension. - && pecl install xdebug \ + pecl install xdebug \ && docker-php-ext-enable xdebug \ - && echo "xdebug.mode=coverage" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \ - \ - # Remove PHP build dependencies. - && apk del -f .build-deps \ - \ - # Clean sources list. - && rm -rf /var/cache/apk/* + && echo "xdebug.mode=coverage" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini USER glpi diff --git a/githubactions-php/Dockerfile b/githubactions-php/Dockerfile index 2332e4d..576281e 100644 --- a/githubactions-php/Dockerfile +++ b/githubactions-php/Dockerfile @@ -1,4 +1,4 @@ -ARG BASE_IMAGE=php:fpm-alpine +ARG BASE_IMAGE=php:fpm-bullseye ##### @@ -18,32 +18,28 @@ LABEL \ org.opencontainers.image.source="git@github.com:glpi-project/docker-images" RUN \ - # Update APK package list. - apk update \ - \ - # Install PHP build dependencies. - && apk add --virtual .build-deps $PHPIZE_DEPS \ + # Update package list. + apt update \ \ # Install exif extension. && docker-php-ext-install exif \ \ # Install GD PHP extension. - && apk add freetype-dev libjpeg-turbo-dev libpng-dev libwebp-dev \ + && apt install --assume-yes --no-install-recommends --quiet libfreetype6-dev libjpeg-dev libpng-dev libwebp-dev \ && docker-php-ext-configure gd --with-freetype --with-jpeg --with-webp \ && docker-php-ext-install gd \ \ # Install intl PHP extension. - && apk add icu-dev icu-data-full \ + && apt install --assume-yes --no-install-recommends --quiet libicu-dev \ && docker-php-ext-install intl \ \ # Install ldap PHP extension. - && apk add --virtual .ldap-build-deps openldap-dev \ - && apk add libldap \ + && apt install --assume-yes --no-install-recommends --quiet libldap2-dev \ + && docker-php-ext-configure ldap --with-libdir=lib/x86_64-linux-gnu/ \ && docker-php-ext-install ldap \ - && apk del -f .ldap-build-deps \ \ # Install memcached PHP extension. - && apk add libmemcached-dev \ + && apt install --assume-yes --no-install-recommends --quiet libmemcached-dev \ && pecl install memcached \ && docker-php-ext-enable memcached \ \ @@ -58,14 +54,12 @@ RUN \ && docker-php-ext-enable redis \ \ # Install Zip PHP extension. - # Zip extension configuration changed on PHP 7.4 - # see https://www.php.net/manual/en/zip.installation.php - && apk add libzip-dev \ + && apt install --assume-yes --no-install-recommends --quiet libzip-dev \ && docker-php-ext-install zip \ \ # Install XMLRPC PHP extension. # Install from Github (extension should be available on PECL but is not) - && apk add libxml2-dev \ + && apt install --assume-yes --no-install-recommends --quiet libxml2-dev \ && mkdir -p /tmp/xmlrpc \ && (curl -LsfS https://github.com/php/pecl-networking-xmlrpc/archive/0f782ffe52cebd0a65356427b7ab72d48b72d20c/xmlrpc-0f782ff.tar.gz | tar xvz -C "/tmp/xmlrpc" --strip 1) \ && docker-php-ext-configure /tmp/xmlrpc --with-xmlrpc \ @@ -85,41 +79,32 @@ RUN \ && rm /usr/local/etc/php/conf.d/docker-php-ext-sodium.ini \ \ # Install nodejs and npm. - && apk add nodejs npm \ + && apt install --assume-yes --no-install-recommends --quiet gnupg \ + && mkdir -p /etc/apt/keyrings \ + && curl --fail --silent --show-error --location https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor --output /etc/apt/keyrings/nodesource.gpg \ + && 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 \ + && apt update \ + && apt install --assume-yes --no-install-recommends --quiet nodejs \ \ # Install git and zip used by composer when fetching dependencies. - && apk add git unzip \ - \ - # Install gettext and perl used to validate locales extraction. - && apk add gettext \ - && apk add perl \ - \ - # Install chromium-chromedriver used for front-end tests. - && apk add chromium-chromedriver \ - \ - # Install sudo that may be usefull to temporarly install upcoming required system components. - && apk add sudo \ - && (echo "glpi ALL=(ALL) NOPASSWD:ALL" | sudo tee /etc/sudoers.d/glpi) \ - \ - # Install bash that is used in some GLPI scripts. - && apk add bash \ + && apt install --assume-yes --no-install-recommends --quiet git unzip \ \ - # Install patch utility that may be usefull to patch dependencies. - && apk add patch \ + # Install gettext used for translation files. + && apt install --assume-yes --no-install-recommends --quiet gettext \ \ - # Remove PHP build dependencies. - && apk del -f .build-deps \ + # Install Cypress dependencies + && apt install --assume-yes --no-install-recommends --quiet libgtk2.0-0 libgtk-3-0 libgbm-dev libnotify-dev libnss3 libxss1 libasound2 libxtst6 xauth xvfb \ \ - # Clean sources list. - && rm -rf /var/cache/apk/* + # Clean sources list + && rm -rf /var/lib/apt/lists/* # Copy composer binary COPY --from=composer /usr/bin/composer /usr/bin/composer # Create application volume (used to share data across jobs), # give its ownage to glpi user (1000:1000) and define it as base working dir -RUN addgroup -g 1000 glpi \ - && adduser -D -h /home/glpi -G glpi -u 1000 glpi \ +RUN addgroup -gid 1000 glpi \ + && useradd -m -d /home/glpi -g glpi -u 1000 glpi \ && mkdir -p /var/glpi \ && chown glpi:glpi /var/glpi USER glpi