From 77ff51a2909fb946d4fae4e9491ec49a6694fb69 Mon Sep 17 00:00:00 2001 From: Matthieu Charreire Date: Tue, 13 Aug 2024 19:25:36 +0200 Subject: [PATCH] feat: add an image with php8.2, alpine20 and node22 --- 8.2-node-22/Dockerfile | 106 +++++++++++++++++++++++++++++++++++++++++ README.md | 3 +- 2 files changed, 108 insertions(+), 1 deletion(-) create mode 100644 8.2-node-22/Dockerfile diff --git a/8.2-node-22/Dockerfile b/8.2-node-22/Dockerfile new file mode 100644 index 0000000..e8f3e16 --- /dev/null +++ b/8.2-node-22/Dockerfile @@ -0,0 +1,106 @@ +FROM php:8.2-alpine3.20 + +RUN apk update \ + && apk upgrade \ + && apk add --no-cache bash linux-headers icu-dev postgresql-dev libzip-dev openldap-dev libpng-dev oniguruma-dev \ + jpegoptim libjpeg libpng imagemagick-dev ghostscript git libxslt-dev rabbitmq-c-dev icu-data-full xmlstarlet \ + && docker-php-ext-install intl mbstring pdo pdo_pgsql zip bcmath sockets ldap gd xsl \ + && set -xe \ + && apk add --no-cache --virtual .build-deps $PHPIZE_DEPS \ + && apk add --no-cache --virtual .imagick-runtime-deps imagemagick \ + && pecl install imagick-3.7.0 \ + && docker-php-ext-enable imagick \ + && pecl install redis xdebug && docker-php-ext-enable redis xdebug \ + && echo -e '\n' | pecl install -o -f amqp \ + && docker-php-ext-enable amqp \ + && apk del .imagick-runtime-deps \ + && apk del .build-deps + + +RUN echo 'memory_limit = 512M' >> /usr/local/etc/php/conf.d/docker-php-memlimit.ini + +ENV XDEBUG_MODE=off + +COPY --from=composer:2 /usr/bin/composer /usr/bin/composer + +# Install node and npm (compile from source as done to build the node:22-alpine3.20 image) +ENV NODE_VERSION=22.6.0 + +RUN addgroup -g 1000 node \ + && adduser -u 1000 -G node -s /bin/sh -D node \ + && apk add --no-cache \ + libstdc++ \ + && apk add --no-cache --virtual .build-deps \ + curl \ + && ARCH= OPENSSL_ARCH='linux*' && alpineArch="$(apk --print-arch)" \ + && case "${alpineArch##*-}" in \ + x86_64) ARCH='x64' CHECKSUM="f5be81dece7dc98c84d5778fc4571fb0ecbc1699fd542c6e3c8969f33b58627c" OPENSSL_ARCH=linux-x86_64;; \ + x86) OPENSSL_ARCH=linux-elf;; \ + aarch64) OPENSSL_ARCH=linux-aarch64;; \ + arm*) OPENSSL_ARCH=linux-armv4;; \ + ppc64le) OPENSSL_ARCH=linux-ppc64le;; \ + s390x) OPENSSL_ARCH=linux-s390x;; \ + *) ;; \ + esac \ + && if [ -n "${CHECKSUM}" ]; then \ + set -eu; \ + curl -fsSLO --compressed "https://unofficial-builds.nodejs.org/download/release/v$NODE_VERSION/node-v$NODE_VERSION-linux-$ARCH-musl.tar.xz"; \ + echo "$CHECKSUM node-v$NODE_VERSION-linux-$ARCH-musl.tar.xz" | sha256sum -c - \ + && tar -xJf "node-v$NODE_VERSION-linux-$ARCH-musl.tar.xz" -C /usr/local --strip-components=1 --no-same-owner \ + && ln -s /usr/local/bin/node /usr/local/bin/nodejs; \ + else \ + echo "Building from source" \ + # backup build + && apk add --no-cache --virtual .build-deps-full \ + binutils-gold \ + g++ \ + gcc \ + gnupg \ + libgcc \ + linux-headers \ + make \ + python3 \ + py-setuptools \ + # use pre-existing gpg directory, see https://github.com/nodejs/docker-node/pull/1895#issuecomment-1550389150 + && export GNUPGHOME="$(mktemp -d)" \ + # gpg keys listed at https://github.com/nodejs/node#release-keys + && for key in \ + 4ED778F539E3634C779C87C6D7062848A1AB005C \ + 141F07595B7B3FFE74309A937405533BE57C7D57 \ + 74F12602B6F1C4E913FAA37AD3A89613643B6201 \ + DD792F5973C6DE52C432CBDAC77ABFA00DDBF2B7 \ + 61FC681DFB92A079F1685E77973F295594EC4689 \ + 8FCCA13FEF1D0C2E91008E09770F7A9A5AE15600 \ + C4F0DFFF4E8C1A8236409D08E73BC641CC11F4C8 \ + 890C08DB8579162FEE0DF9DB8BEAB4DFCF555EF4 \ + C82FA3AE1CBEDC6BE46B9360C43CEC45C17AB93C \ + 108F52B48DB57BB0CC439B2997B01419BD92F80A \ + A363A499291CBBC940DD62E41F10027AF002F8B0 \ + CC68F5A3106FF448322E48ED27F5E38D5B0A215F \ + ; do \ + gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys "$key" || \ + gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key" ; \ + done \ + && curl -fsSLO --compressed "https://nodejs.org/dist/v$NODE_VERSION/node-v$NODE_VERSION.tar.xz" \ + && curl -fsSLO --compressed "https://nodejs.org/dist/v$NODE_VERSION/SHASUMS256.txt.asc" \ + && gpg --batch --decrypt --output SHASUMS256.txt SHASUMS256.txt.asc \ + && gpgconf --kill all \ + && rm -rf "$GNUPGHOME" \ + && grep " node-v$NODE_VERSION.tar.xz\$" SHASUMS256.txt | sha256sum -c - \ + && tar -xf "node-v$NODE_VERSION.tar.xz" \ + && cd "node-v$NODE_VERSION" \ + && ./configure \ + && make -j$(getconf _NPROCESSORS_ONLN) V= \ + && make install \ + && apk del .build-deps-full \ + && cd .. \ + && rm -Rf "node-v$NODE_VERSION" \ + && rm "node-v$NODE_VERSION.tar.xz" SHASUMS256.txt.asc SHASUMS256.txt; \ + fi \ + && rm -f "node-v$NODE_VERSION-linux-$ARCH-musl.tar.xz" \ + # Remove unused OpenSSL headers to save ~34MB. See this NodeJS issue: https://github.com/nodejs/node/issues/46451 + && find /usr/local/include/node/openssl/archs -mindepth 1 -maxdepth 1 ! -name "$OPENSSL_ARCH" -exec rm -rf {} \; \ + && apk del .build-deps \ + # smoke tests + && node --version \ + && npm --version diff --git a/README.md b/README.md index 69247b6..8b2bb73 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ Symfony-ready ============= -Docker images based on alpine 3 with php 7/8, node v12/14/16/18, composer 1/2 & following PHP exts: +Docker images based on alpine 3 with php 7/8, node v12/14/16/18/20/22, composer 1/2 & following PHP exts: - intl - json - mbstring @@ -25,3 +25,4 @@ Docker images based on alpine 3 with php 7/8, node v12/14/16/18, composer 1/2 & | 8.1 | 8.1 | 2 | 16 | | 8.2 | 8.2 | 2 | 18 | | 8.2-node-20 | 8.2 | 2 | 20 | +| 8.2-node-22 | 8.2 | 2 | 22 |