{"id":15025836,"url":"https://github.com/evilwizardcreations/php7.2-fpm-nginx-docker-example","last_synced_at":"2026-02-14T04:34:51.319Z","repository":{"id":205743423,"uuid":"612649717","full_name":"EvilWizardCreations/php7.2-fpm-nginx-docker-example","owner":"EvilWizardCreations","description":"A base PHP-FPM 7.2 \u0026 Nginx image for simulating some current production environments.","archived":false,"fork":false,"pushed_at":"2023-11-07T08:23:12.000Z","size":35,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-13T01:41:27.363Z","etag":null,"topics":["development","docker","docker-compose","docker-container","docker-image","dockerfile","dockerhub-image","legacy","nginx","nginx-docker","php72","phpfpm"],"latest_commit_sha":null,"homepage":"https://hub.docker.com/r/ewc2020/web/tags","language":"Dockerfile","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/EvilWizardCreations.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-03-11T15:22:22.000Z","updated_at":"2023-11-07T10:36:49.000Z","dependencies_parsed_at":"2025-01-19T18:39:42.390Z","dependency_job_id":"14415fc4-a220-4ecd-a35b-992b3fdbe7e7","html_url":"https://github.com/EvilWizardCreations/php7.2-fpm-nginx-docker-example","commit_stats":null,"previous_names":["evilwizardcreations/php7.2-fpm-nginx-docker-example"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/EvilWizardCreations/php7.2-fpm-nginx-docker-example","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EvilWizardCreations%2Fphp7.2-fpm-nginx-docker-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EvilWizardCreations%2Fphp7.2-fpm-nginx-docker-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EvilWizardCreations%2Fphp7.2-fpm-nginx-docker-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EvilWizardCreations%2Fphp7.2-fpm-nginx-docker-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/EvilWizardCreations","download_url":"https://codeload.github.com/EvilWizardCreations/php7.2-fpm-nginx-docker-example/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EvilWizardCreations%2Fphp7.2-fpm-nginx-docker-example/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264922851,"owners_count":23683698,"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":["development","docker","docker-compose","docker-container","docker-image","dockerfile","dockerhub-image","legacy","nginx","nginx-docker","php72","phpfpm"],"created_at":"2024-09-24T20:03:07.611Z","updated_at":"2026-02-14T04:34:51.249Z","avatar_url":"https://github.com/EvilWizardCreations.png","language":"Dockerfile","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PHP-FPM 7.2 Dockerfile Example\n\nA base PHP-FPM 7.2 image[^docker_pull_cmd_note] for demonstrating legacy projects available at [EWC Docker Hub](https://hub.docker.com/r/ewc2020/web).\n\nAn old version of ***PHP*** that some codebase sites still require to emulate a ***production*** environment to run in.\n\nOther Packages Included:\n\n- Node v14.x\n- Composer v1.10.1\n- libxml2-dev\n- libzip-dev\n- libyaml-dev\n- zip\n- unzip\n- git\n- nodejs\n- default-mysql-client\n- vim\n- npm i npm@`$NPM_VERSION`[^npm_version_note] -g\n- yaml\n\nPHP Extensions:\n\n- gettext \n- mysqli \n- pdo_mysql \n- zip\n- yaml\n\n## Build \u0026 Compose Up\n\nNote that the `php-7.2-fpm` is the Docker Compose Service to ***Build***.\n\nThere is a build script included that uses the local `.env` file \u0026 an [Evil Wizard Creations Protocol](https://bitbucket.org/evilwizardcreations/ewc-protocols) that makes this much simpler.\n\n```bash\nbuild-up-php-7.2-fpm.sh\n```\n\nAlternatively there is the *full Procedure*.\n\n1. Build the Image using the `docker-compose-build.yaml` configuration.\n\n    ```bash\n    docker-compose -f ./docker-compose-build.yaml build --no-cache php-5-6-cli\n    ```\n\n1. Compose *Up* using the `docker-compose-build.yaml` configuration will use the new built Image and `-d` to *detach*.\n\n    ```bash\n    docker-compose -f ./docker-compose-build.yaml up -d\n    ```\n\n## Build Image The Long Way\n\nBuild the ***Docker Image*** without using ***cached*** versions of previous image build stages.\n\n```bash\nsudo docker build \\\n    -f php-7-2-fpm.Dockerfile \\\n    --target build-php-7-2-fpm \\\n    --build-arg APP_ENV=local \\\n    --build-arg NPM_VERSION=7.24.2 \\\n    --no-cache \\\n    -t php-7.2-fpm:latest \\\n    .\n```\n\n**N.B.**\n\n- Using `-f php-7-2-fpm.Dockerfile`\n\n    To specify the *filename* to ***build*** otherwise it is expected to be named `Dockerfile`.\n\n- Using `--target build-php-7-2-fpm`\n\n    To select the ***build target stage***[^multi_stage_builds_note] from the *Dockerfile*.\n    \n- Using `--build-arg ARG=value`\n\n    To set build argument values to use.\n\n### Create A Container\n\nThis creates a named container and attaches it to the ***host network*** and may cause port conflict if the host machine is already listening on any exposed ports from the ***Docker Image*** being used.\n\n```bash\nsudo docker run \\\n    -d \\\n    --network host \\\n    -v \"$(pwd)\"/public_html:/var/www/html \\\n    --name php-7-2-fpm \\\n    php-7-2-fpm:latest\n```\n\n**OR**\n\nThis creates a named container and attaches it to the ***bridge network*** and allows for ***port forward mapping*** from the ***host*** to the ***Container***.\n\n```bash\nsudo docker run \\\n    -d \\\n    --network bridge \\\n    -p 8080:80/tcp \\\n    -v \"$(pwd)\"/public_html:/var/www/html \\\n    --name php-7-2-fpm \\\n    php-7-2-fpm:latest\n```\n\n**N.B.**\n\n- Using `-v \"$(pwd)\"/public_html:/var/www/html`\n\n    To ***Volume Mount*** the folder `public_html` from the current folder to `/var/www/html` on the ***running*** container. It is where ***Apache*** serves the content from \u0026 allows for *realtime* change updates.\n\n- Using `-p 8080:80/tcp` \n\n    To map port **8080** on the ***Host*** machine to port **80** on the ***Container*** using the ***bridge network***.\n\n- Using `--name php-7-2-fpm`\n\n    To name the ***Container*** being created.\n\n### Start Container\n\n```bash\nsudo docker start php-7-2-fpm\n```\n\n### Stop Container\n\n```bash\nsudo docker stop php-7-2-fpm\n```\n\n## Connect To Container\n\n```bash\nsudo docker exec -it php-7-2-fpm /bin/bash\n```\n\n# Disclaimer\n\nThis Nginx + PHP-FPM 7.2 build environment should ***NOT*** be used anywhere near a ***production*** environment. This build is for showcasing legacy systems that simple would not run in modern environments \u0026 as such it is littered with security holes and exploitation's.\n\n[^docker_pull_cmd_note]: Use `docker pull ewc2020/web:php-7.2-fpm-latest` to get a copy of the image.\n\n[^npm_version_note]: Uses a `.env` ***build-arg*** called ***NPM_VERSION*** to specify the npm version.\n\n[^multi_stage_builds_note]: Used mostly in ***Multi Stage*** image builds.\n\n[^compose_name_note]: The `php-7-2-fpm` container name to build the image for.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fevilwizardcreations%2Fphp7.2-fpm-nginx-docker-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fevilwizardcreations%2Fphp7.2-fpm-nginx-docker-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fevilwizardcreations%2Fphp7.2-fpm-nginx-docker-example/lists"}