From 03f83bc304534264c2d3536b4b3a284b964d7b7e Mon Sep 17 00:00:00 2001 From: Deon George Date: Tue, 6 Jul 2021 16:08:35 +1000 Subject: [PATCH] PHP with graphic libraries --- .gitlab-ci.yml | 30 ++++++++++++++++-------------- Dockerfile | 22 +++++++++++----------- Dockerfile.phptest | 12 ++++++++++++ 3 files changed, 39 insertions(+), 25 deletions(-) create mode 100644 Dockerfile.phptest diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 4654d18..e193032 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,11 +1,11 @@ image: docker:latest stages: -- test - build +- build-test variables: - BRANCH: plus + BRANCH: image VERSION: 8.0-fpm-${BRANCH} CACHETAG: build-${BRANCH} DOCKER_HOST: tcp://docker:2375 @@ -18,16 +18,6 @@ before_script: - docker version - echo "$CI_JOB_TOKEN" | docker login -u "$CI_REGISTRY_USER" "$CI_REGISTRY" --password-stdin -test: - stage: test - script: - - cat /etc/hosts - - env|sort - - docker build -t ${CI_REGISTRY_IMAGE}:${VERSION} . - - docker images - only: - - debug - x86_64:build: stage: build script: @@ -36,9 +26,21 @@ x86_64:build: - docker build --cache-from ${CI_REGISTRY_IMAGE}:${CACHETAG} -t ${CI_REGISTRY_IMAGE}:${VERSION} -t ${CI_REGISTRY_IMAGE}:${CACHETAG} . - docker push ${CI_REGISTRY_IMAGE}:${VERSION} - docker push ${CI_REGISTRY_IMAGE}:${CACHETAG} - - apk add curl && curl -LX POST --post301 -F token=${TRIGGER_TOKEN} -F ref=ext ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/trigger/pipeline tags: - docker - x86_64 only: - - plus + - image + +x86_64:build-test: + stage: build-test + script: + - if [ -f init ]; then chmod 500 init; fi + - ([ -z "$REFRESH" ] && docker pull ${CI_REGISTRY_IMAGE}:${CACHETAG}) || true + - docker build --file Dockerfile.phptest --cache-from ${CI_REGISTRY_IMAGE}:${CACHETAG} -t ${CI_REGISTRY_IMAGE}:${VERSION}-test . + - docker push ${CI_REGISTRY_IMAGE}:${VERSION}-test + tags: + - docker + - x86_64 + only: + - image diff --git a/Dockerfile b/Dockerfile index b79c0d4..082251d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,15 @@ # NAME leenooks/php -# VERSION 8.0-fpm-plus +# VERSION 8.0-fpm-image -FROM registry.leenooks.net/leenooks/php:8.0-fpm-mp +FROM registry.leenooks.net/leenooks/php:8.0-fpm-latest + +RUN mv /sbin/init /sbin/init.tmp \ + && apt-get update \ + && apt-get install -yqq wkhtmltopdf \ + && apt purge -yqq systemd-sysv dconf-service \ + && apt autoremove -yqq \ + && rm -rf /var/lib/apt/lists/* /tmp/* \ + && mv /sbin/init.tmp /sbin/init RUN cd /usr/local/bin && curl -OsL https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions && chmod +x install-php-extensions @@ -33,8 +41,7 @@ RUN mv /sbin/init /sbin/init.tmp \ && make install \ && ldconfig \ && apt-get install -y libbz2-dev libgmp-dev libpng-dev libjpeg-dev libfreetype6-dev --no-install-recommends \ - && docker-php-ext-configure gd --with-freetype=/usr/include/freetype2 --with-jpeg=/usr/include/ \ - && docker-php-ext-install -j$(nproc) bz2 sockets gmp gd pcntl exif \ + && docker-php-ext-install -j$(nproc) gmp exif \ && install-php-extensions imagick \ && apt-get purge -y build-essential libtool wget libbz2-dev libgmp-dev libpng-dev libjpeg-dev libfreetype6-dev \ hicolor-icon-theme texlive-base texlive-binaries libx11-dev automake autotools-dev bsdmainutils dbus-user-session dbus-user-session doxygen \ @@ -48,10 +55,3 @@ RUN mv /sbin/init /sbin/init.tmp \ && rm -rf /var/lib/apt/lists/* /tmp/* \ && rm -rf /usr/src/libde265 /usr/src/libheif /usr/src/ImageMagick \ && mv /sbin/init.tmp /sbin/init - -RUN apt-get -y update \ - && apt-get -y install build-essential libzip4 libzip-dev zlib1g-dev \ - && docker-php-ext-install -j$(nproc) zip \ - && apt-get purge -y build-essential libzip-dev zlib1g-dev \ - && apt-get autoremove -y \ - && rm -rf /var/lib/apt/lists/* /tmp/* diff --git a/Dockerfile.phptest b/Dockerfile.phptest new file mode 100644 index 0000000..64d94ae --- /dev/null +++ b/Dockerfile.phptest @@ -0,0 +1,12 @@ +# NAME leenooks/php +# VERSION 8.0-fpm-test + +FROM registry.leenooks.net/leenooks/php:8.0-fpm-latest + +RUN pecl install xdebug \ + && docker-php-ext-enable xdebug + +RUN apt-get update && apt-get install -y npm \ + && apt-get -y autoremove \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*