{"id":19818453,"url":"https://github.com/bscheshirwork/docker-php","last_synced_at":"2025-05-01T11:32:17.664Z","repository":{"id":74313353,"uuid":"83299599","full_name":"bscheshirwork/docker-php","owner":"bscheshirwork","description":":whale: Based at official images https://hub.docker.com/_/php and expand it.","archived":false,"fork":false,"pushed_at":"2023-10-10T14:25:23.000Z","size":93,"stargazers_count":8,"open_issues_count":0,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2023-10-10T22:03:43.456Z","etag":null,"topics":["composer","dockerfile","php","xdebug","yii2","zts"],"latest_commit_sha":null,"homepage":"","language":"Dockerfile","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bscheshirwork.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2017-02-27T10:48:37.000Z","updated_at":"2023-10-08T18:49:56.000Z","dependencies_parsed_at":null,"dependency_job_id":"5fab64b1-2936-46a3-a7fe-c55264a211ae","html_url":"https://github.com/bscheshirwork/docker-php","commit_stats":null,"previous_names":[],"tags_count":37,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bscheshirwork%2Fdocker-php","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bscheshirwork%2Fdocker-php/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bscheshirwork%2Fdocker-php/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bscheshirwork%2Fdocker-php/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bscheshirwork","download_url":"https://codeload.github.com/bscheshirwork/docker-php/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224253318,"owners_count":17280934,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["composer","dockerfile","php","xdebug","yii2","zts"],"created_at":"2024-11-12T10:15:41.992Z","updated_at":"2024-11-12T10:15:42.613Z","avatar_url":"https://github.com/bscheshirwork.png","language":"Dockerfile","funding_links":[],"categories":[],"sub_categories":[],"readme":"# php\n\nBased at :whale:[official images](https://hub.docker.com/_/php/) \nand expand it.\n\nSupported tags and respective `Dockerfile` links\n================================================\n\n\n## for yii2  \n\n- `8.2.11-fpm-4yii2`, `fpm-4yii2` ([yii2/Dockerfile](./yii2/Dockerfile))\n- `8.2.11-fpm-4yii2-xdebug`, `fpm-4yii2-xdebug` ([yii2-xdebug/Dockerfile](./yii2-xdebug/Dockerfile))  \n- `8.2.11-fpm-alpine-4yii2`, `fpm-alpine-4yii2` ([yii2-alpine/Dockerfile](./yii2-alpine/Dockerfile))\n- `8.2.11-fpm-alpine-4yii2-xdebug`, `fpm-alpine-4yii2-xdebug` ([yii2-alpine-xdebug/Dockerfile](./yii2-alpine-xdebug/Dockerfile))\n- `8.2.11-fpm-alpine-4yii2-supervisor`, `fpm-alpine-4yii2-supervisor` ([yii2-alpine-supervisor/Dockerfile](./yii2-alpine-supervisor/Dockerfile))\n- `8.2.11-fpm-alpine-4yii2-supervisor-xdebug`, `fpm-alpine-4yii2-supervisor-xdebug` ([yii2-alpine-supervisor-xdebug/Dockerfile](./yii2-alpine-supervisor-xdebug/Dockerfile))\n\nFROM `php:fpm`\n\nadded `composer` (global --optimize-autoloader)\n\nadded `yii2 dependences` (all pass requirements.php, :information_source: ApcCache: Alternatively `APCu PHP` extension could be used via setting `useApcu` to `true` )\n\ntag: `{sourceref}-4yii2`\n\nadded `Xdebug 3.2.2`\n\ntag: `{sourceref}-4yii2-xdebug`\n\n`docker pull bscheshir/php:8.2.11-fpm-alpine-4yii2-xdebug`\n\n\n## Usage\n### Example for yii2 [docker-compose.yml](https://github.com/bscheshirwork/docker-yii2-app-advanced/blob/master/docker-run/docker-compose.yml)\n```yml\nversion: '2'\nservices:\n  php:\n    image: bscheshir/php:8.2.11-fpm-alpine-4yii2-xdebug\n    restart: unless-stopped\n    volumes:\n      - ../php-code:/var/www/html #php-code\n      - ~/.composer/cache:/root/.composer/cache\n    depends_on:\n      - db\n    environment:\n      TZ: Europe/Moscow\n      XDEBUG_CONFIG: \"client_host=${DEV_REMOTE_HOST} client_port=${DEV_REMOTE_PORT}\"\n      PHP_IDE_CONFIG: \"serverName=${DEV_SERVER_NAME}\"\n    extra_hosts:\n      - \"host.docker.internal:host-gateway\"\n  nginx:\n    image: nginx:1.17-alpine\n    restart: unless-stopped\n    ports:\n      - \"8080:8080\"\n      - \"8081:8081\"\n    depends_on:\n      - php\n    volumes_from:\n      - php\n    volumes:\n      - ../nginx-conf:/etc/nginx/conf.d #nginx-conf\n      - ../nginx-logs:/var/log/nginx #nginx-logs\n    environment:\n      TZ: Europe/Moscow\n  mysql:\n    image: mysql:8.0.18\n    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\n    restart: unless-stopped\n    expose:\n      - \"3306\" #for service mysql-proxy\n    ports:\n      - \"3307:3306\" #for external connection\n    volumes:\n      - ../mysql-data/db:/var/lib/mysql #mysql-data\n    environment:\n      TZ: Europe/Moscow\n      MYSQL_ROOT_PASSWORD: yii2advanced\n      MYSQL_DATABASE: yii2advanced\n      MYSQL_USER: yii2advanced\n      MYSQL_PASSWORD: yii2advanced\n  db: #mysql-proxy\n    image: bscheshir/mysql-proxy:0.8.5\n    expose:\n      - \"3306\" #for service php\n    ports:\n      - \"3308:3306\" #for external connection\n    restart: unless-stopped\n    volumes:\n      - ../mysql-proxy-conf:/opt/mysql-proxy/conf\n      - ../mysql-proxy-logs:/opt/mysql-proxy/logs\n    depends_on:\n      - mysql\n    environment:\n      TZ: Europe/Moscow\n      PROXY_DB_HOST:\n      PROXY_DB_PORT: 3306\n      REMOTE_DB_HOST: mysql\n      REMOTE_DB_PORT: 3306\n      LUA_SCRIPT: \"/opt/mysql-proxy/conf/log.lua\"\n      LOG_FILE: \"/opt/mysql-proxy/logs/mysql.log\"\n```\n\n### Example run command\n\nphpinfo | xdebug\n\nfrom `docker-run` dir\n```\ndocker-compose run --rm php -i |grep xdebug\n```\nor \n```\ndocker-compose -f ~/projects/yii2project/docker-run/docker-compose.yml run --rm php -i |grep xdebug\n```\n\ncrontab (full path needed)\n```\n*/10 * * * * /usr/local/bin/docker-compose -f /home/user/projects/yii2project/docker-compose.yml run --rm php ./yii command/action\n```\n\n\n### Example `supervisor` [docker-compose.yml](https://github.com/bscheshirwork/docker-yii2-app-advanced-redis/blob/master/docker-run/docker-compose.yml)\n```\nversion: '2'\nservices:\n  php-supervisor: # for workers\n    image: bscheshir/php:8.2.11-fpm-alpine-4yii2-supervisor-xdebug\n    restart: unless-stopped\n    volumes:\n      - ../php-code:/var/www/html #php-code\n      - ../supervisor-conf:/etc/supervisor/conf.d\n      - ../supervisor-logs:/var/log/supervisor\n    depends_on:\n      - db\n    environment:\n      TZ: Europe/Moscow\n      XDEBUG_CONFIG: \"remote_host=host.docker.internal remote_port=9003 var_display_max_data=1024 var_display_max_depth=5\"\n      PHP_IDE_CONFIG: \"serverName=yii2advanced\"\n    extra_hosts:\n      - \"host.docker.internal:host-gateway\"\n```\n\n## How to build manually \n\n### Clone or get fresh\n```sh\ngit clone https://github.com/bscheshirwork/docker-php.git\ncd docker-php\ngit pull\n```\n\n### Build and push. \n\nFor example `bscheshir/php:fpm-alpine-4yii2-xdebug` - this image will be used in [docker-codeception-yii2](https://github.com/bscheshirwork/docker-codeception-yii2)\nand another `alpine` images\n```sh\ndocker build -t bscheshir/php:8.2.11-fpm-alpine-4yii2-xdebug -t bscheshir/php:fpm-alpine-4yii2-xdebug --pull -- ./yii2-alpine-xdebug\ndocker push bscheshir/php:8.2.11-fpm-alpine-4yii2-xdebug\ndocker push bscheshir/php:fpm-alpine-4yii2-xdebug\n\ndocker build -t bscheshir/php:8.2.11-fpm-alpine-4yii2 -t bscheshir/php:fpm-alpine-4yii2 --pull -- ./yii2-alpine\ndocker push bscheshir/php:8.2.11-fpm-alpine-4yii2\ndocker push bscheshir/php:fpm-alpine-4yii2\n\ndocker build -t bscheshir/php:8.2.11-fpm-alpine-4yii2-supervisor-xdebug -t bscheshir/php:fpm-alpine-4yii2-supervisor-xdebug --pull -- ./yii2-alpine-supervisor-xdebug\ndocker push bscheshir/php:8.2.11-fpm-alpine-4yii2-supervisor-xdebug\ndocker push bscheshir/php:fpm-alpine-4yii2-supervisor-xdebug\n\ndocker build -t bscheshir/php:8.2.11-fpm-alpine-4yii2-supervisor -t bscheshir/php:fpm-alpine-4yii2-supervisor --pull -- ./yii2-alpine-supervisor\ndocker push bscheshir/php:8.2.11-fpm-alpine-4yii2-supervisor\ndocker push bscheshir/php:fpm-alpine-4yii2-supervisor\n```\n\n# User and groups\n\n## alpine\nWe can assign standard `alpine` uid of `www-data` to new `local user` for granted access to some places from `php`.  \nFor example if you have `dev` group in Ubuntu:  \n```sh\nsudo useradd -u 82 -g dev -MN alpine-www-data\n``` \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbscheshirwork%2Fdocker-php","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbscheshirwork%2Fdocker-php","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbscheshirwork%2Fdocker-php/lists"}