{"id":27431835,"url":"https://github.com/existenznl/docker-webstack","last_synced_at":"2025-04-14T15:35:14.043Z","repository":{"id":21841567,"uuid":"90799110","full_name":"eXistenZNL/Docker-Webstack","owner":"eXistenZNL","description":"A webstack container built on Alpine, running Nginx, PHP, and S6-overlay.","archived":false,"fork":false,"pushed_at":"2025-03-05T08:31:53.000Z","size":95,"stargazers_count":92,"open_issues_count":1,"forks_count":32,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-03-05T09:29:51.508Z","etag":null,"topics":["alpine-linux","docker","nginx","php","s6-overlay"],"latest_commit_sha":null,"homepage":"","language":"Dockerfile","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/eXistenZNL.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","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},"funding":{"github":"eXistenZNL"}},"created_at":"2017-05-09T22:56:23.000Z","updated_at":"2025-03-05T08:31:24.000Z","dependencies_parsed_at":"2023-02-10T22:45:48.956Z","dependency_job_id":"eeafb861-415d-41bd-83f0-e7cae013d3f9","html_url":"https://github.com/eXistenZNL/Docker-Webstack","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eXistenZNL%2FDocker-Webstack","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eXistenZNL%2FDocker-Webstack/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eXistenZNL%2FDocker-Webstack/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eXistenZNL%2FDocker-Webstack/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eXistenZNL","download_url":"https://codeload.github.com/eXistenZNL/Docker-Webstack/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248906829,"owners_count":21181223,"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":["alpine-linux","docker","nginx","php","s6-overlay"],"created_at":"2025-04-14T15:33:32.892Z","updated_at":"2025-04-14T15:35:14.034Z","avatar_url":"https://github.com/eXistenZNL.png","language":"Dockerfile","readme":"# Docker Webstack\n\n[![Build Status](https://img.shields.io/github/actions/workflow/status/eXistenZNL/Docker-Webstack/build-containers.yml?branch=master\u0026style=flat-square)](https://github.com/eXistenZNL/Docker-Webstack/actions) [![Docker Pulls](https://img.shields.io/docker/pulls/existenz/webstack.svg?style=flat-square)](https://hub.docker.com/r/existenz/webstack/) [![License](https://img.shields.io/github/license/existenznl/docker-webstack.svg?style=flat-square)](https://github.com/eXistenZNL/Docker-Webstack/blob/master/LICENSE) [![Sponsors](https://img.shields.io/github/sponsors/eXistenZNL?color=hotpink\u0026style=flat-square)](https://github.com/sponsors/eXistenZNL)\n\n## About\n\nThis container is a fairly simple Nginx / PHP-FPM container that can be used as a base for your own web containers. It makes use of [s6-overlay](https://github.com/just-containers/s6-overlay) as it's init daemon / process supervisor, and comes in various PHP versions (see below). It is rebuilt and tested every day on Travis-CI, so you will always have the latest security patches of Nginx and PHP on hand.\n\n## Why?\n\nI can hear you thinking \"aren't there already plenty good Nginx / PHP containers out there?\".\nTo me, there weren't, as I found that all existing containers either run some kind of bash script to start both Nginx and PHP, or use [supervisord](http://supervisord.org/) to start one or more processes in the background.\nThe former felt really hacky to me, and the latter is not meant to be used as an init daemon as [it does not handle the different signals for process 1 properly](https://blog.phusion.nl/2015/01/20/docker-and-the-pid-1-zombie-reaping-problem/) and makes your container possibly end up with zombie processes.\n\nSo I started looking for proper init daemons that can take care of this situation and I found [s6-overlay](https://github.com/just-containers/s6-overlay) which explains in great detail how they overcame the aforementioned problems.\n\n## The goals of this container\n\n- Be always up to date with the latest [packages from Alpine Linux](https://pkgs.alpinelinux.org/packages)\n- Minimize the lines of code needed in your own Dockerfile and optimize readibility.\n- Have sane defaults for Nginx, PHP, and FPM that can be easily overwritten if needed.\n\n## How can I use it?\n\nYou can create your own containers based upon this container with a simple FROM in your Dockerfile.\n\n### Before you start\n\nBefore start hacking away, you should know this:\n- Nginx runs under the system's nginx user, and PHP-FPM runs under the system's php user.\n- The code should be copied into /www, as this is the default directory Nginx and PHP work with in this container.\n- When not using a CMS or framework like Laravel / Symfony / WordPress that brings its own public folder, copy to /www/public instead.\n- Any PHP modules needed in your project should be installed by using apk, Alpine Linux's package manager and the package names for installing can be looked up in the version table below.\n\nThen there are some tips or rather guidelines that I adhere to personally, but ultimately this is just a matter of taste:\n- [S6-overlay can set permissions when the container starts up](https://github.com/just-containers/s6-overlay#fixing-ownership--permissions), but this can be slow if a lot of permissions need to be set, so just do this when building the container.\n\n### Basic example\n\nNow that we know all that, we can do something like this:\n```\nFROM existenz/webstack:8.3\n\nCOPY --chown=php:nginx src/ /www\n\nRUN find /www -type d -exec chmod -R 555 {} \\; \\\n    \u0026\u0026 find /www -type f -exec chmod -R 444 {} \\; \\\n    \u0026\u0026 find /www/var -type d -exec chmod -R 755 {} \\; \\\n    \u0026\u0026 find /www/var -type f -exec chmod -R 644 {} \\; \\\n    \u0026\u0026 apk -U --no-cache add \\\n    php83-ctype \\\n    php83-json \\\n    php83-mbstring\n```\nAnd you should now have a working container that runs your PHP project!\n\n### Versions\n\n\u003e Tags ending with a `-description` install packages from different repositories to keep up with the latest PHP\n\u003e versions. These are probably short-lived and will be replaced with their default counterpart as soon as these PHP\n\u003e versions make it into the default Alpine repositories. You can use them, just keep in mind you will have to switch\n\u003e over to the default container at one point.\n\u003e\n\u003e Codecasts containers are no longer provided, see [this issue](https://github.com/codecasts/php-alpine/issues/131) for\n\u003e more information.\n\nSee the table below to see what versions are currently available:\n\n| Image tag | Based on          | PHP Packages from                                                                               | S6-Overlay |\n|-----------|-------------------|-------------------------------------------------------------------------------------------------|------------|\n| 8.1       | Alpine Linux 3.18 | [Alpine Linux repo](https://pkgs.alpinelinux.org/packages?name=php81*\u0026branch=v3.18\u0026arch=x86_64) | Version 1  |\n| 8.2       | Alpine Linux 3.19 | [Alpine Linux repo](https://pkgs.alpinelinux.org/packages?name=php82*\u0026branch=v3.19\u0026arch=x86_64) | Version 1  |\n| 8.3       | Alpine Linux 3.19 | [Alpine Linux repo](https://pkgs.alpinelinux.org/packages?name=php83*\u0026branch=v3.19\u0026arch=x86_64) | Version 3  |\n| 8.4       | Alpine Linux 3.21 | [Alpine Linux repo](https://pkgs.alpinelinux.org/packages?name=php84*\u0026branch=v3.21\u0026arch=x86_64) | Version 3  |\n\n### Overriding or extending the configuration\n\nIf you want to augment of replace the configuration of Nginx, PHP or FPM, there are multiple options:\n- Place one or more configuration files in specific directories to augment the configuration\n- If that does not suit your needs, you can also simply overwrite the configuration files altogether\n\nThese are the files to add or overwrite in order to configure the different parts of the webstack:\n\n| Application               | Copy files into this directory | Overwrite this file if needed |\n|---------------------------|--------------------------------|-------------------------------|\n| PHP core directives (8.1) | /etc/php81/conf.d/             | /etc/php81/php.ini            |\n| PHP-FPM (8.1)             | /etc/php81/php-fpm.d/          | /etc/php81/php-fpm.conf       |\n| PHP core directives (8.2) | /etc/php82/conf.d/             | /etc/php82/php.ini            |\n| PHP-FPM (8.2)             | /etc/php82/php-fpm.d/          | /etc/php82/php-fpm.conf       |\n| PHP core directives (8.3) | /etc/php83/conf.d/             | /etc/php83/php.ini            |\n| PHP-FPM (8.3)             | /etc/php83/php-fpm.d/          | /etc/php83/php-fpm.conf       |\n| PHP core directives (8.4) | /etc/php84/conf.d/             | /etc/php84/php.ini            |\n| PHP-FPM (8.4)             | /etc/php84/php-fpm.d/          | /etc/php84/php-fpm.conf       |\n| Nginx                     | /etc/nginx/conf.d/             | /etc/nginx/nginx.conf         |\n\n## Bugs, questions, and improvements\n\nIf you found a bug or have a question, please open an issue on the GitHub Issue tracker.\nImprovements can be sent by a Pull Request against the master branch and are greatly appreciated!\n\n## Contributors\n\nThanks everyone for helping out with this project!\n\n[![Contributor avatars](https://contrib.rocks/image?repo=eXistenZNL/Docker-Webstack)](https://github.com/eXistenZNL/Docker-Webstack/graphs/contributors)\n","funding_links":["https://github.com/sponsors/eXistenZNL"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fexistenznl%2Fdocker-webstack","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fexistenznl%2Fdocker-webstack","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fexistenznl%2Fdocker-webstack/lists"}