Sign inSign up

bscheshir/php

By bscheshir

•Updated almost 3 years ago

Based at [official images](https://hub.docker.com/_/php/) and expand it.

Image
1

10K+

bscheshir/php repository overview

⁠php

Based at :whale:official images⁠ and expand it.

⁠for yii2

note: based on fpm-alpine3.11 used OpenSSL instead LibreSSL note: OpenSSL 1.1.0 breaks backwards compatibility with old encrypted keys. Errors like "fopen(): Unable to set local cert chain file"; "Curl error: #58 - could not load PEM client certificate, OpenSSL error error:140AB18E:SSL routines:SSL_CTX_use_certificate:ca md too weak, (no key found, wrong pass phrase, or wrong file format?)" Use sha256 encrypted keys.

FROM php:fpm

added composer (global require hirak/prestissimo:^0.3.0)

added yii2 dependences (all pass requirements.php, :information_source: ApcCache: Alternatively APCu PHP extension could be used via setting useApcu to true )

tag: {sourceref}-4yii2

added Xdebug 2.9.2

tag: {sourceref}-4yii2-xdebug

docker pull bscheshir/php:7.4.3-fpm-4yii2-xdebug

⁠for zts

FROM php:zts

added pthreads

tag: {sourceref}-zts

added Xdebug

tag: {sourceref}-zts-xdebug

⁠Usage

⁠Example for yii2 docker-compose.yml⁠
version: '2'
services:
  php:
    image: bscheshir/php:7.4.3-fpm-alpine-4yii2-xdebug
    restart: always
    volumes:
      - ../php-code:/var/www/html #php-code
      - ~/.composer/cache:/root/.composer/cache
    depends_on:
      - db
    environment:
      TZ: Europe/Moscow
      XDEBUG_CONFIG: "remote_host=${DEV_REMOTE_HOST} remote_port=${DEV_REMOTE_PORT} var_display_max_data=1024 var_display_max_depth=5"
      PHP_IDE_CONFIG: "serverName=${DEV_SERVER_NAME}"
  nginx:
    image: nginx:1.17-alpine
    restart: always
    ports:
      - "8080:8080"
      - "8081:8081"
    depends_on:
      - php
    volumes_from:
      - php
    volumes:
      - ../nginx-conf:/etc/nginx/conf.d #nginx-conf
      - ../nginx-logs:/var/log/nginx #nginx-logs
    environment:
      TZ: Europe/Moscow
  mysql:
    image: mysql:8.0.18
    entrypoint: ['/entrypoint.sh', '--default-authentication-plugin=mysql_native_password'] # https://dev.mysql.com/doc/refman/8.0/en/server-system-variables.html#sysvar_default_authentication_plugin
    restart: always
    expose:
      - "3306" #for service mysql-proxy
    ports:
      - "3307:3306" #for external connection
    volumes:
      - ../mysql-data/db:/var/lib/mysql #mysql-data
    environment:
      TZ: Europe/Moscow
      MYSQL_ROOT_PASSWORD: yii2advanced
      MYSQL_DATABASE: yii2advanced
      MYSQL_USER: yii2advanced
      MYSQL_PASSWORD: yii2advanced
  db: #mysql-proxy
    image: bscheshir/mysql-proxy:0.8.5
    expose:
      - "3306" #for service php
    ports:
      - "3308:3306" #for external connection
    restart: always
    volumes:
      - ../mysql-proxy-conf:/opt/mysql-proxy/conf
      - ../mysql-proxy-logs:/opt/mysql-proxy/logs
    depends_on:
      - mysql
    environment:
      TZ: Europe/Moscow
      PROXY_DB_HOST:
      PROXY_DB_PORT: 3306
      REMOTE_DB_HOST: mysql
      REMOTE_DB_PORT: 3306
      LUA_SCRIPT: "/opt/mysql-proxy/conf/log.lua"
      LOG_FILE: "/opt/mysql-proxy/logs/mysql.log"
⁠Example run command

phpinfo | xdebug

from docker-run dir

docker-compose run --rm php -i |grep xdebug

or

docker-compose -f ~/projects/yii2project/docker-run/docker-compose.yml run --rm php -i |grep xdebug

crontab (full path needed)

*/10 * * * * /usr/local/bin/docker-compose -f /home/user/projects/yii2project/docker-compose.yml run --rm php ./yii command/action
⁠Example supervisor docker-compose.yml⁠
version: '2'
services:
  php-supervisor: # for workers
    image: bscheshir/php:7.4.3-fpm-alpine-4yii2-supervisor-xdebug
    restart: always
    volumes:
      - ../php-code:/var/www/html #php-code
      - ../supervisor-conf:/etc/supervisor/conf.d
      - ../supervisor-logs:/var/log/supervisor
    depends_on:
      - db
    environment:
      TZ: Europe/Moscow
      XDEBUG_CONFIG: "remote_host=dev-Aspire-V3-772 remote_port=9003 var_display_max_data=1024 var_display_max_depth=5"
      PHP_IDE_CONFIG: "serverName=yii2advanced"
⁠Example zts docker-compose.yml⁠
version: '2'
services:
  php:
    image: bscheshir/php:7.4.3-zts
    restart: always
    hostname: phphost
    working_dir: /multispider
    depends_on:
      - db
    volumes:
      - ..:/multispider #php-code
      - ~:/home/user
  db:
    image: postgres:11-alpine
    restart: always
    volumes:
      - ../.db:/var/lib/postgresql/data #DB-data
    environment:
      POSTGRES_PASSWORD: multispider
      POSTGRES_DB: multispider
      POSTGRES_USER: multispider

⁠How to build manually

⁠Clone or get fresh
git clone https://github.com/bscheshirwork/docker-php.git
cd docker-php
git pull
⁠Build and push.

For example bscheshir/php:fpm-alpine-4yii2-xdebug - this image will be used in docker-codeception-yii2⁠ and another alpine images

docker build -t bscheshir/php:7.4.3-fpm-alpine-4yii2-xdebug -t bscheshir/php:fpm-alpine-4yii2-xdebug --pull -- ./yii2-alpine-xdebug
docker push bscheshir/php:7.4.3-fpm-alpine-4yii2-xdebug
docker push bscheshir/php:fpm-alpine-4yii2-xdebug

docker build -t bscheshir/php:7.4.3-fpm-alpine-4yii2 -t bscheshir/php:fpm-alpine-4yii2 --pull -- ./yii2-alpine
docker push bscheshir/php:7.4.3-fpm-alpine-4yii2
docker push bscheshir/php:fpm-alpine-4yii2

docker build -t bscheshir/php:7.4.3-fpm-alpine-4yii2-supervisor-xdebug -t bscheshir/php:fpm-alpine-4yii2-supervisor-xdebug --pull -- ./yii2-alpine-supervisor-xdebug
docker push bscheshir/php:7.4.3-fpm-alpine-4yii2-supervisor-xdebug
docker push bscheshir/php:fpm-alpine-4yii2-supervisor-xdebug

docker build -t bscheshir/php:7.4.3-fpm-alpine-4yii2-supervisor -t bscheshir/php:fpm-alpine-4yii2-supervisor --pull -- ./yii2-alpine-supervisor
docker push bscheshir/php:7.4.3-fpm-alpine-4yii2-supervisor
docker push bscheshir/php:fpm-alpine-4yii2-supervisor

⁠User and groups

⁠alpine

We can assign standard alpine uid of www-data to new local user for granted access to some places from php.
For example if you have dev group in Ubuntu:

sudo useradd -u 82 -g dev -MN alpine-www-data

Tag summary

Content type

Image

Digest

sha256:18c6b29e6…

Size

291.1 MB

Last updated

almost 3 years ago

docker pull bscheshir/php:8.2.11-fpm-alpine-4yii2-supervisor