diff --git a/Makefile b/Makefile index a611b00..b294671 100644 --- a/Makefile +++ b/Makefile @@ -39,6 +39,9 @@ php: ## Builds all "php" images docker build --tag=ajardin/php:8.2 php/8.2 docker build --tag=ajardin/php:8.2-blackfire php/8.2/blackfire docker build --tag=ajardin/php:8.2-xdebug php/8.2/xdebug + docker build --tag=ajardin/php:8.3 php/8.3 + docker build --tag=ajardin/php:8.3-blackfire php/8.3/blackfire + docker build --tag=ajardin/php:8.3-xdebug php/8.3/xdebug .PHONY: php help: diff --git a/php/.github/workflows/publish_83.yml b/php/.github/workflows/publish_83.yml new file mode 100644 index 0000000..ec074fc --- /dev/null +++ b/php/.github/workflows/publish_83.yml @@ -0,0 +1,62 @@ +name: "Publish to Docker Hub (8.3)" + +on: + push: + branches: ["**"] + paths: + - ".github/workflows/publish_83.yml" + - "8.3/**" + schedule: + - cron: "0 0 * * *" + workflow_dispatch: + inputs: + +jobs: + publish: + runs-on: ubuntu-latest + + steps: + - name: "Prepare the build context" + uses: actions/checkout@v2 + + - name: "Set up QEMU" + uses: docker/setup-qemu-action@v1 + + - name: "Set up Docker Buildx" + uses: docker/setup-buildx-action@v1 + + - name: "Log in to DockerHub" + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: "Build & Publish the Docker image (default)" + uses: docker/build-push-action@v2 + with: + context: ./8.3/ + tags: ajardin/php:8."" + platforms: linux/amd64,linux/arm64 + push: ${{ github.ref == 'refs/heads/main' }} + cache-from: type=registry,ref=ajardin/php:8.3 + cache-to: type=inline + + - name: "Build & Publish the Docker image (Blackfire)" + uses: docker/build-push-action@v2 + with: + context: ./8.3/blackfire/ + tags: ajardin/php:8.3-blackfire + platforms: linux/amd64,linux/arm64 + push: ${{ github.ref == 'refs/heads/main' }} + cache-from: type=registry,ref=ajardin/php:8.3-blackfire + cache-to: type=inline + + - name: "Build & Publish the Docker image (Xdebug)" + uses: docker/build-push-action@v2 + with: + context: ./8.3/xdebug/ + tags: ajardin/php:8.3-xdebug + platforms: linux/amd64,linux/arm64 + push: ${{ github.ref == 'refs/heads/main' }} + cache-from: type=registry,ref=ajardin/php:8.3-xdebug + cache-to: type=inline diff --git a/php/8.3/Dockerfile b/php/8.3/Dockerfile new file mode 100644 index 0000000..bb1cf23 --- /dev/null +++ b/php/8.3/Dockerfile @@ -0,0 +1,92 @@ +FROM php:8.3-fpm + +LABEL org.opencontainers.image.authors="Alexandre Jardin " +LABEL org.opencontainers.image.title="Custom PHP 8.3 image for an application supported by Origami." +LABEL org.opencontainers.image.description="https://github.com/origamiphp/docker-images/blob/main/php/README.md" +LABEL org.opencontainers.image.source="https://github.com/origamiphp/docker-images/blob/main/php/8.3/Dockerfile" + +# Installs the system requirements +RUN \ + apt update && \ + apt install -y --no-install-recommends \ + git \ + jq \ + libc-client-dev \ + libfreetype-dev \ + libicu-dev \ + libkrb5-dev \ + libjpeg-dev \ + libpng-dev \ + libpq-dev \ + libssh2-1-dev \ + libtidy-dev \ + libwebp-dev \ + libxml2-dev \ + libxml2-utils \ + libxslt-dev \ + libzip-dev \ + nano \ + procps \ + ssh-client \ + ssmtp \ + unzip + +# Installs the PHP extensions +RUN \ + docker-php-ext-configure imap --with-kerberos --with-imap-ssl && \ + docker-php-ext-configure gd --with-freetype --with-jpeg --with-webp && \ + docker-php-ext-install -j$(nproc) \ + bcmath \ + exif \ + imap \ + intl \ + gd \ + opcache \ + pcntl \ + pdo_mysql \ + pdo_pgsql \ + soap \ + sockets \ + tidy \ + xsl \ + zip && \ + yes "" | pecl install apcu redis ssh2-beta && \ + docker-php-ext-enable apcu redis ssh2 && \ + perl -pi -e "s|;pm.status_path = /status|pm.status_path = /php_fpm_status|g" /usr/local/etc/php-fpm.d/www.conf && \ + perl -pi -e "s/mailhub=mail/mailhub=maildev/" /etc/ssmtp/ssmtp.conf + +# Installs the JavaScript dependencies +RUN \ + curl -fsSL https://deb.nodesource.com/setup_17.x | bash - && \ + apt install -y --no-install-recommends nodejs && \ + curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - && \ + echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list && \ + apt update && \ + apt install -y --no-install-recommends yarn && \ + yarn global add grunt-cli gulp + +# Assigns a new UID/GID to avoid using a generated value +RUN \ + usermod -u 1000 www-data && \ + groupmod -g 1000 www-data + +# Give www-data permissions to its home folder +RUN chown www-data:www-data /var/www + +# Installs the "netz98/n98-magerun2" package +RUN \ + curl -sS https://files.magerun.net/n98-magerun2.phar --output /usr/local/bin/magerun2 && \ + chmod +x /usr/local/bin/magerun2 + +# Installs Composer globally and configures it +COPY --from=composer:latest /usr/bin/composer /usr/bin/composer +ENV COMPOSER_ALLOW_SUPERUSER 1 +ENV COMPOSER_MEMORY_LIMIT -1 +ENV COMPOSER_HOME /.composer +ENV COMPOSER_CACHE_DIR /.composer/cache + +# Installs the custom entrypoint +COPY --from=ajardin/php-entrypoint:latest /usr/local/bin/docker-custom-entrypoint /usr/local/bin/docker-custom-entrypoint +RUN chmod 777 /usr/local/bin/docker-custom-entrypoint +CMD ["php-fpm"] +ENTRYPOINT ["docker-custom-entrypoint"] diff --git a/php/8.3/blackfire/Dockerfile b/php/8.3/blackfire/Dockerfile new file mode 100644 index 0000000..3049ed1 --- /dev/null +++ b/php/8.3/blackfire/Dockerfile @@ -0,0 +1,19 @@ +FROM ajardin/php:8.3 + +LABEL org.opencontainers.image.authors="Alexandre Jardin " +LABEL org.opencontainers.image.title="Custom PHP 8.3 image with Blackfire for an application supported by Origami." +LABEL org.opencontainers.image.description="https://github.com/origamiphp/docker-images/blob/main/php/README.md" +LABEL org.opencontainers.image.source="https://github.com/origamiphp/docker-images/blob/main/php/8.3/blackfire/Dockerfile" + +# Installs the Blackfire PHP probe +RUN \ + version=$(php -r "echo PHP_MAJOR_VERSION.PHP_MINOR_VERSION;") && \ + architecture=$(case $(uname -m) in i386 | i686 | x86) echo "i386" ;; x86_64 | amd64) echo "amd64" ;; aarch64 | arm64 | armv8) echo "arm64" ;; *) echo "amd64" ;; esac) && \ + curl -A "Docker" -o /tmp/blackfire-probe.tar.gz -D - -L -s "https://blackfire.io/api/v1/releases/probe/php/linux/${architecture}/${version}" && \ + mkdir -p /tmp/blackfire && \ + tar zxpf /tmp/blackfire-probe.tar.gz -C /tmp/blackfire && \ + mv /tmp/blackfire/blackfire-*.so $(php -r "echo ini_get ('extension_dir');")/blackfire.so && \ + chown root:root $(php -r "echo ini_get ('extension_dir');")/blackfire.so && \ + chmod 755 $(php -r "echo ini_get ('extension_dir');")/blackfire.so && \ + rm -rf /tmp/blackfire /tmp/blackfire-probe.tar.gz && \ + docker-php-ext-enable blackfire diff --git a/php/8.3/xdebug/Dockerfile b/php/8.3/xdebug/Dockerfile new file mode 100644 index 0000000..78c3ad2 --- /dev/null +++ b/php/8.3/xdebug/Dockerfile @@ -0,0 +1,11 @@ +FROM ajardin/php:8.3 + +LABEL org.opencontainers.image.authors="Alexandre Jardin " +LABEL org.opencontainers.image.title="Custom PHP 8.3 image with Xdebug for an application supported by Origami." +LABEL org.opencontainers.image.description="https://github.com/origamiphp/docker-images/blob/main/php/README.md" +LABEL org.opencontainers.image.source="https://github.com/origamiphp/docker-images/blob/main/php/8.3/xdebug/Dockerfile" + +# Installs the Xdebug extension +RUN \ + yes "" | pecl install xdebug && \ + docker-php-ext-enable xdebug diff --git a/php/README.md b/php/README.md index 7def8c0..75c8345 100644 --- a/php/README.md +++ b/php/README.md @@ -15,6 +15,12 @@ > :information_source: Only images of officially supported PHP versions are regularly updated. +* [![Image size (8.3)](https://img.shields.io/docker/image-size/ajardin/php/8.3?label=ajardin%2Fphp%3A8.3)](/php/8.3/Dockerfile) +* [![Image size (8.3 with Blackfire)](https://img.shields.io/docker/image-size/ajardin/php/8.3-blackfire?label=ajardin%2Fphp%3A8.3-blackfire)](/php/8.3/blackfire/Dockerfile) +* [![Image size (8.3 with Xdebug)](https://img.shields.io/docker/image-size/ajardin/php/8.3-xdebug?label=ajardin%2Fphp%3A8.3-xdebug)](/php/8.3/xdebug/Dockerfile) + +[]() + * [![Image size (8.2)](https://img.shields.io/docker/image-size/ajardin/php/8.2?label=ajardin%2Fphp%3A8.2)](/php/8.2/Dockerfile) * [![Image size (8.2 with Blackfire)](https://img.shields.io/docker/image-size/ajardin/php/8.2-blackfire?label=ajardin%2Fphp%3A8.2-blackfire)](/php/8.2/blackfire/Dockerfile) * [![Image size (8.2 with Xdebug)](https://img.shields.io/docker/image-size/ajardin/php/8.2-xdebug?label=ajardin%2Fphp%3A8.2-xdebug)](/php/8.2/xdebug/Dockerfile) @@ -45,14 +51,14 @@ ## 🚀 Usage ```bash -docker run --interactive --tty --volume=$(pwd):/var/www/html ajardin/php:8.2 sh +docker run --interactive --tty --volume=$(pwd):/var/www/html ajardin/php:8.3 sh ``` ```yaml services: # [...] php: - image: ajardin/php:8.2 + image: ajardin/php:8.3 environment: - SSH_AUTH_SOCK=/run/host-services/ssh-auth.sock volumes: