Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add node-php images for php 7.4 #15

Merged
merged 3 commits into from
Feb 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,19 @@ jobs:
- path: node-php/8.0/buster/fpm
tags:
- riptidepy/node-php:8.0-fpm
- path: node-php/7.4/buster/cli-composer
tags:
- riptidepy/node-php:7.4-cli
- riptidepy/node-php:7.4
- path: node-php/7.4/buster/cli-composer2
tags:
- riptidepy/node-php:7.4-cli-composer2
- path: node-php/7.4/buster/apache
tags:
- riptidepy/node-php:7.4-apache
- path: node-php/7.4/buster/fpm
tags:
- riptidepy/node-php:7.4-fpm
- path: sphinx
tags:
- riptidepy/sphinx:latest
Expand Down
12 changes: 12 additions & 0 deletions node-php/7.4/buster/apache/000-default.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<VirtualHost *:80>
ServerAdmin webmaster@riptide
DocumentRoot "/src"

ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined

<Directory "/src">
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
103 changes: 103 additions & 0 deletions node-php/7.4/buster/apache/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
# THIS IS AUTO-GENERATED by builder/build.sh. DO NOT EDIT.
FROM php:7.4-apache-buster

LABEL php_xdebug_version="3"

# Some parts are based on https://hub.docker.com/r/alexcheng/magento2/dockerfile

# PHP extensions, msmtp, NodeJS and NPM
RUN requirements="nodejs npm msmtp libmcrypt-dev libwebp-dev libmcrypt4 libcurl3-dev libfreetype6 libjpeg62-turbo libjpeg62-turbo-dev libpng-dev libxpm-dev libfreetype6-dev libicu-dev libxslt1-dev unzip libbz2-dev libzip-dev openssh-client libonig-dev git ssh-askpass libssl-dev libyaml-dev" \
&& apt-get update \
&& apt-get install -y $requirements \
&& docker-php-ext-install pdo_mysql \
&& docker-php-ext-install mysqli \
&& docker-php-ext-install soap \
&& docker-php-ext-install xsl \
&& docker-php-ext-install zip \
&& docker-php-ext-install intl \
&& docker-php-ext-install bcmath \
&& docker-php-ext-install bz2 \
&& docker-php-ext-install sockets \
&& docker-php-ext-configure gd --with-freetype --with-jpeg \
&& docker-php-ext-install gd \
&& docker-php-ext-install exif \
&& docker-php-ext-install opcache \
&& requirementsToRemove="libmcrypt-dev libwebp-dev libcurl3-dev libpng-dev libfreetype6-dev libjpeg62-turbo-dev libxpm-dev libbz2-dev libzip-dev libonig-dev" \
&& apt-get purge -y $requirementsToRemove \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

# Install xdebug (based on https://gist.github.com/chadrien/c90927ec2d160ffea9c4)
RUN yes | pecl install xdebug-3.1.6

# Install yaml
RUN yes | pecl install yaml && echo "extension=yaml.so" > /usr/local/etc/php/conf.d/ext-yaml.ini

# Riptide no longer enabled xdebug in it's image, for performance reasons.
# Please mount
# For Riptide < 0.6: The PHP commands/services in the Riptide Community Repository mount these settings already
# For Riptide >= 0.6: Use the plugin riptide-plugin-php-xdebug to toggle Xdebug.
#
# Previously these were the settings for Xdebug:
#&& echo "zend_extension=$(find /usr/local/lib/php/extensions/ -name xdebug.so)" > /usr/local/etc/php/conf.d/xdebug.ini \
#&& echo "xdebug.remote_enable=on" >> /usr/local/etc/php/conf.d/xdebug.ini \
#&& echo "xdebug.remote_autostart=off" >> /usr/local/etc/php/conf.d/xdebug.ini

# Composer 1
RUN curl -sS https://getcomposer.org/installer | php -- --1 \
&& mv composer.phar /usr/local/bin/composer

# Composer 2
RUN curl -sS https://getcomposer.org/installer | php \
&& mv composer.phar /usr/local/bin/composer2

# wp-cli
RUN curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar \
&& chmod +x ./wp-cli.phar \
&& mv ./wp-cli.phar /usr/local/bin/ \
&& ln -s /usr/local/bin/wp-cli.phar /usr/local/bin/wp-cli \
&& ln -s /usr/local/bin/wp-cli.phar /usr/local/bin/wp

# Magerun
RUN curl -O https://files.magerun.net/n98-magerun.phar \
&& chmod +x ./n98-magerun.phar \
&& mv ./n98-magerun.phar /usr/local/bin/ \
&& ln -s /usr/local/bin/n98-magerun.phar /usr/local/bin/magerun \
&& ln -s /usr/local/bin/n98-magerun.phar /usr/local/bin/mr

# Magerun2
RUN curl -O https://files.magerun.net/n98-magerun2.phar \
&& chmod +x ./n98-magerun2.phar \
&& mv ./n98-magerun2.phar /usr/local/bin/ \
&& ln -s /usr/local/bin/n98-magerun2.phar /usr/local/bin/mr2 \
&& ln -s /usr/local/bin/n98-magerun2.phar /usr/local/bin/magerun2

## Symfony
RUN curl -O https://get.symfony.com/cli/installer \
&& chmod +x ./installer \
&& ./installer --install-dir /usr/local/bin \
&& rm ./installer

# Additional settings
# || true for non-apache variants
RUN a2enmod rewrite || true \
&& echo "memory_limit=-1" > /usr/local/etc/php/conf.d/memory-limit.ini \
&& echo "sendmail_path = /usr/bin/msmtp -t" > /usr/local/etc/php/conf.d/sendmail.ini

# PHP-FPM:
# Since we use a template build, this get's executed in all images... could possibly
# change that in the future
RUN mkdir -p /usr/local/etc/php-fpm.d/ \
# Allow the FPM process to access the environment variables passed in
&& echo "clear_env = no" >> /usr/local/etc/php-fpm.d/www.conf \
# logging
&& echo "php_admin_flag[log_errors] = on" >> /usr/local/etc/php-fpm.d/www.conf

# Make /src the root source directory
RUN rm -rf /usr/src && ln -s /src /usr/src

# Globally install yarn
RUN npm install --global yarn

WORKDIR /src
COPY 000-default.conf /etc/apache2/sites-enabled/000-default.conf
151 changes: 151 additions & 0 deletions node-php/7.4/buster/apache/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
# Supported tags and respective `Dockerfile` links

- [`8.3-cli`, `8-cli`, `cli`, `8.3`, `8`, `latest` (*8.3/buster/cli-composer/Dockerfile*)](https://github.com/theCapypara/riptide-docker-images/tree/master/node-php/8.3/buster/cli-composer/Dockerfile)
- [`8.3-cli-composer2`, `8-cli-composer2`, `cli-composer` (*8.3/buster/cli-composer/Dockerfile*)](https://github.com/theCapypara/riptide-docker-images/tree/master/node-php/8.3/buster/cli-composer2/Dockerfile)
- [`8.3-apache`, `8-apache`, `apache` (*8.3/buster/apache/Dockerfile*)](https://github.com/theCapypara/riptide-docker-images/tree/master/node-php/8.3/buster/apache/Dockerfile)
- [`8.3-fpm`, `8-fpm`, `fpm` (*8.3/buster/fpm/Dockerfile*)](https://github.com/theCapypara/riptide-docker-images/tree/master/node-php/8.3/buster/fpm/Dockerfile)
- [`8.2-cli`, `8.2` (*8.2/buster/cli-composer/Dockerfile*)](https://github.com/theCapypara/riptide-docker-images/tree/master/node-php/8.2/buster/cli-composer/Dockerfile)
- [`8.2-cli-composer2` (*8.2/buster/cli-composer2/Dockerfile*)](https://github.com/theCapypara/riptide-docker-images/tree/master/node-php/8.2/buster/cli-composer2/Dockerfile)
- [`8.2-apache` (*8.2/buster/apache/Dockerfile*)](https://github.com/theCapypara/riptide-docker-images/tree/master/node-php/8.2/buster/apache/Dockerfile)
- [`8.2-fpm` (*8.2/buster/fpm/Dockerfile*)](https://github.com/theCapypara/riptide-docker-images/tree/master/node-php/8.2/buster/fpm/Dockerfile)
- [`8.1-cli`, `8.1` (*8.1/buster/cli-composer/Dockerfile*)](https://github.com/theCapypara/riptide-docker-images/tree/master/node-php/8.1/buster/cli-composer/Dockerfile)
- [`8.1-cli-composer2` (*8.1/buster/cli-composer2/Dockerfile*)](https://github.com/theCapypara/riptide-docker-images/tree/master/node-php/8.1/buster/cli-composer2/Dockerfile)
- [`8.1-apache` (*8.1/buster/apache/Dockerfile*)](https://github.com/theCapypara/riptide-docker-images/tree/master/node-php/8.1/buster/apache/Dockerfile)
- [`8.1-fpm` (*8.1/buster/fpm/Dockerfile*)](https://github.com/theCapypara/riptide-docker-images/tree/master/node-php/8.1/buster/fpm/Dockerfile)
- [`8.0-cli`, `8.0` (*8.0/buster/cli-composer/Dockerfile*)](https://github.com/theCapypara/riptide-docker-images/tree/master/node-php/8.0/buster/cli-composer/Dockerfile)
- [`8.0-cli-composer2` (*8.0/buster/cli-composer2/Dockerfile*)](https://github.com/theCapypara/riptide-docker-images/tree/master/node-php/8.0/buster/cli-composer2/Dockerfile)
- [`8.0-apache` (*8.0/buster/apache/Dockerfile*)](https://github.com/theCapypara/riptide-docker-images/tree/master/node-php/8.0/buster/apache/Dockerfile)
- [`8.0-fpm` (*8.0/buster/fpm/Dockerfile*)](https://github.com/theCapypara/riptide-docker-images/tree/master/node-php/8.0/buster/fpm/Dockerfile)
- [`7.4-cli`, `7-cli`, `7.4`, `7` (*7.4/buster/cli-composer/Dockerfile*)](https://github.com/theCapypara/riptide-docker-images/tree/master/node-php/7.4/buster/cli-composer/Dockerfile)
- [`7.4-cli-composer2` (*7.4/buster/cli-composer2/Dockerfile*)](https://github.com/theCapypara/riptide-docker-images/tree/master/node-php/7.4/buster/cli-composer2/Dockerfile)
- [`7.4-apache`, `7-apache` (*7.4/buster/apache/Dockerfile*)](https://github.com/theCapypara/riptide-docker-images/tree/master/node-php/7.4/buster/apache/Dockerfile)
- [`7.4-fpm`, `7-fpm` (*7.4/buster/fpm/Dockerfile*)](https://github.com/theCapypara/riptide-docker-images/tree/master/node-php/7.4/buster/fpm/Dockerfile)

# Quick reference

- **Where to get help**:
[the Riptide Docker Images Github Repository](https://github.com/theCapypara/riptide-docker-images)

- **Where to file issues**:
[https://github.com/theCapypara/riptide-docker-images/issues](https://github.com/theCapypara/riptide-docker-images/issues)

- **Maintained by**:
[the Riptide Community](https://github.com/theCapypara/riptide-docker-images)

- **Source of this description**:
[README in riptide-docker-images repo](https://github.com/theCapypara/riptide-docker-images/tree/master/node-php) ([history](https://github.com/theCapypara/riptide-docker-images/tree/master/node-php))

# What is node-php?

node-php images based on the [official php images](https://hub.docker.com/_/php) with the debian [nodejs package](https://packages.debian.org/sid/nodejs) included.

These images work like their official counterpart, but:

- They include the following php extensions (additional may be installed by default, depending on php version):
- xdebug 3 (not loaded by default & and controlled via XDEBUG_CONFIG, see below)
- pdo_mysql
- mysqli
- gd
- mbstring
- soap
- xsl
- intl
- ctype
- iconv
- json
- session
- simplexml
- tokenizer
- bcmath
- bz2
- sockets
- yaml
- They include the following tools for developing with common php applications and Frameworks
- [Composer](https://getcomposer.org/)
- Composer 1 as `composer`
- Composer 2 as `composer2`
- NOTE: The `cli-composer2` images instead only contain Composer 2, linked as both `composer` and `composer2`.
- [wp-cli](https://wp-cli.org/)
- [n98-magerun](https://github.com/netz98/n98-magerun)
- [n98-magerun2](https://github.com/netz98/n98-magerun2)
- [Symfony CLI](https://symfony.com/)
- msmtp is installed by default to be used with a mailcatcher. It is configured in the php.ini but no msmtprc
file is present. If you want to use msmtp, create an "/etc/msmtprc".
- Includes an SSH client
- Includes Git

Xdebug is not loaded by default for performance reasons. If you want
to enable Xdebug, add the following lines to the file ``/usr/local/etc/php/conf.d/xdebug.ini`` via a new image or mount:
```ini
zend_extension=xdebug.so
xdebug.remote_enable=on
xdebug.remote_autostart=off
```


This image is meant for developers using php and node. If you are missing any extensions
or tools, be sure to open a [pull request](https://github.com/theCapypara/riptide-docker-images/pulls).

# How to use this image.

See the description of the [official php images](https://hub.docker.com/_/php).
The directory used for app sources is `/src`, not `/usr/src`!
Commands and scripts can additionally make use of `node`, `npm`, `npx` and `yarn`.

This image is meant to be used with [Riptide](https://github.com/theCapypara/riptide-cli).
Using it without Riptide is probably possible, but not supported.

## Basic Usage with Riptide

A simple php app that uses the apache variant to run an Apache web-server:

```yaml
app:
name: php-demo
services:
php_demo:
image: riptidepy/node-php:7.4-apache
environment:
APACHE_RUN_USER: '#{{ os_user() }}'
APACHE_RUN_GROUP: '#{{ os_group() }}'
port: 80
run_as_current_user: false
roles:
- main
- src
```

For all image variants, expect for `apache`:

- This image supports ``run_as_current_user: true`` for services (this is the default).

For the `apache` image variant:

- This image only supports ``run_as_current_user: false`` for services.
To run the image with the user controlling riptide, instead of the image user, provide the APACHE_RUN_USER and APACHE_RUN_GROUP environment variables,
as shown in the example above.

## Basic Usage with Docker Run

See the description of the [official php images](https://hub.docker.com/_/php) and [official Node images](https://hub.docker.com/_/node).

# Environment Variables

| Name | Required | Example Value(s) | Description |
|-----------------|----------|-------------------------------------|---------------------------------------------------------------------|
| APACHE_RUN_USER | see desc.| #1000 / #{{ os_user() }} (Riptide) | (apache only) ID of the user that Apache should switch to |
| APACHE_RUN_GROUP| see desc.| #1000 / #{{ os_group() }} (Riptide) | (apache only) ID of the group that the main command should switch to|
| XDEBUG_CONFIG | no | client_host={{ host_address() }} | [Xdebug configuration](https://xdebug.org/docs/remote) |
| XDEBUG_CONFIG | no | serverName=riptide-{{ name }}' | [phpStorm path mapping key](https://blog.jetbrains.com/phpstorm/2012/03/new-in-4-0-easier-debugging-of-remote-php-command-line-scripts/)|

More environment variables may be provided by php, php-FPM, Apache, php extensions or Node.

# Volumes

- **/src**: Source code

# Image Variants

See the description of the [official php images](https://hub.docker.com/_/php). Only
variants for FPM, CLI and Apache are provided. Only variants based on Debian buster are provided.
Every variant includes the latest nodejs package that was present in the debian repositories at the time of building.
102 changes: 102 additions & 0 deletions node-php/7.4/buster/cli-composer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
# THIS IS AUTO-GENERATED by builder/build.sh. DO NOT EDIT.
FROM php:7.4-cli-buster

LABEL php_xdebug_version="3"

# Some parts are based on https://hub.docker.com/r/alexcheng/magento2/dockerfile

# PHP extensions, msmtp, NodeJS and NPM
RUN requirements="nodejs npm msmtp libmcrypt-dev libwebp-dev libmcrypt4 libcurl3-dev libfreetype6 libjpeg62-turbo libjpeg62-turbo-dev libpng-dev libxpm-dev libfreetype6-dev libicu-dev libxslt1-dev unzip libbz2-dev libzip-dev openssh-client libonig-dev git ssh-askpass libssl-dev libyaml-dev" \
&& apt-get update \
&& apt-get install -y $requirements \
&& docker-php-ext-install pdo_mysql \
&& docker-php-ext-install mysqli \
&& docker-php-ext-install soap \
&& docker-php-ext-install xsl \
&& docker-php-ext-install zip \
&& docker-php-ext-install intl \
&& docker-php-ext-install bcmath \
&& docker-php-ext-install bz2 \
&& docker-php-ext-install sockets \
&& docker-php-ext-configure gd --with-freetype --with-jpeg \
&& docker-php-ext-install gd \
&& docker-php-ext-install exif \
&& docker-php-ext-install opcache \
&& requirementsToRemove="libmcrypt-dev libwebp-dev libcurl3-dev libpng-dev libfreetype6-dev libjpeg62-turbo-dev libxpm-dev libbz2-dev libzip-dev libonig-dev" \
&& apt-get purge -y $requirementsToRemove \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

# Install xdebug (based on https://gist.github.com/chadrien/c90927ec2d160ffea9c4)
RUN yes | pecl install xdebug-3.1.6

# Install yaml
RUN yes | pecl install yaml && echo "extension=yaml.so" > /usr/local/etc/php/conf.d/ext-yaml.ini

# Riptide no longer enabled xdebug in it's image, for performance reasons.
# Please mount
# For Riptide < 0.6: The PHP commands/services in the Riptide Community Repository mount these settings already
# For Riptide >= 0.6: Use the plugin riptide-plugin-php-xdebug to toggle Xdebug.
#
# Previously these were the settings for Xdebug:
#&& echo "zend_extension=$(find /usr/local/lib/php/extensions/ -name xdebug.so)" > /usr/local/etc/php/conf.d/xdebug.ini \
#&& echo "xdebug.remote_enable=on" >> /usr/local/etc/php/conf.d/xdebug.ini \
#&& echo "xdebug.remote_autostart=off" >> /usr/local/etc/php/conf.d/xdebug.ini

# Composer 1
RUN curl -sS https://getcomposer.org/installer | php -- --1 \
&& mv composer.phar /usr/local/bin/composer

# Composer 2
RUN curl -sS https://getcomposer.org/installer | php \
&& mv composer.phar /usr/local/bin/composer2

# wp-cli
RUN curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar \
&& chmod +x ./wp-cli.phar \
&& mv ./wp-cli.phar /usr/local/bin/ \
&& ln -s /usr/local/bin/wp-cli.phar /usr/local/bin/wp-cli \
&& ln -s /usr/local/bin/wp-cli.phar /usr/local/bin/wp

# Magerun
RUN curl -O https://files.magerun.net/n98-magerun.phar \
&& chmod +x ./n98-magerun.phar \
&& mv ./n98-magerun.phar /usr/local/bin/ \
&& ln -s /usr/local/bin/n98-magerun.phar /usr/local/bin/magerun \
&& ln -s /usr/local/bin/n98-magerun.phar /usr/local/bin/mr

# Magerun2
RUN curl -O https://files.magerun.net/n98-magerun2.phar \
&& chmod +x ./n98-magerun2.phar \
&& mv ./n98-magerun2.phar /usr/local/bin/ \
&& ln -s /usr/local/bin/n98-magerun2.phar /usr/local/bin/mr2 \
&& ln -s /usr/local/bin/n98-magerun2.phar /usr/local/bin/magerun2

## Symfony
RUN curl -O https://get.symfony.com/cli/installer \
&& chmod +x ./installer \
&& ./installer --install-dir /usr/local/bin \
&& rm ./installer

# Additional settings
# || true for non-apache variants
RUN a2enmod rewrite || true \
&& echo "memory_limit=-1" > /usr/local/etc/php/conf.d/memory-limit.ini \
&& echo "sendmail_path = /usr/bin/msmtp -t" > /usr/local/etc/php/conf.d/sendmail.ini

# PHP-FPM:
# Since we use a template build, this get's executed in all images... could possibly
# change that in the future
RUN mkdir -p /usr/local/etc/php-fpm.d/ \
# Allow the FPM process to access the environment variables passed in
&& echo "clear_env = no" >> /usr/local/etc/php-fpm.d/www.conf \
# logging
&& echo "php_admin_flag[log_errors] = on" >> /usr/local/etc/php-fpm.d/www.conf

# Make /src the root source directory
RUN rm -rf /usr/src && ln -s /src /usr/src

# Globally install yarn
RUN npm install --global yarn

WORKDIR /src
Loading
Loading