All Projects → eXistenZNL → Docker-Webstack

eXistenZNL / Docker-Webstack

Licence: MIT license
A webstack container built on Alpine, running Nginx, PHP, and S6-overlay.

Programming Languages

Roff
2310 projects
Makefile
30231 projects
PHP
23972 projects - #3 most used programming language

Projects that are alternatives of or similar to Docker-Webstack

alpine-qbittorrent-openvpn
qBittorrent docker container with OpenVPN client running as unprivileged user on alpine linux
Stars: ✭ 230 (+259.38%)
Mutual labels:  alpine-linux, s6-overlay
index
A PEP 503-compliant Python package index specifically providing wheels built for Alpine Linux
Stars: ✭ 26 (-59.37%)
Mutual labels:  alpine-linux
docker-alpine-arm
🗻 Build AlpineLinuxArm Docker Image for RaspberryPi
Stars: ✭ 20 (-68.75%)
Mutual labels:  alpine-linux
docker-linguist
GitHub Linguist Docker image
Stars: ✭ 24 (-62.5%)
Mutual labels:  alpine-linux
pi-factory
Bootstrap a bitcoin lightning box for Raspberry Pi 3 based on Alpine Linux
Stars: ✭ 17 (-73.44%)
Mutual labels:  alpine-linux
alpine-php-fpm
Lightweight and optimised PHP-FPM (PHP 7.4, 8.0, 8.1) Docker images with essential extensions on top of latest Alpine Linux.
Stars: ✭ 53 (-17.19%)
Mutual labels:  alpine-linux
docker-ejtserver
EJT License Server Docker image
Stars: ✭ 18 (-71.87%)
Mutual labels:  alpine-linux
docker flutter
Alpine Linux image for Flutter & Dart with helpful utils and web build support.
Stars: ✭ 33 (-48.44%)
Mutual labels:  alpine-linux
alpine-prestashop
Prestashop running on Alpine Linux [Docker]
Stars: ✭ 13 (-79.69%)
Mutual labels:  alpine-linux
docker-dind-awscli
A Docker image for Docker-in-Docker (dind) with AWS CLI v2 awscli tool included
Stars: ✭ 36 (-43.75%)
Mutual labels:  alpine-linux
headless-chrome-alpine
A Docker container running headless Chrome
Stars: ✭ 26 (-59.37%)
Mutual labels:  alpine-linux
alpine
🐧 **Deprecated** PHP.earth Alpine Linux repository
Stars: ✭ 15 (-76.56%)
Mutual labels:  alpine-linux
lnmp-docker
Docker for LNMP ( Alpine Linux + PHP7 + Nginx+ Supervisor + Crontab ) 开发环境镜像
Stars: ✭ 23 (-64.06%)
Mutual labels:  alpine-linux
docker-mongodb-backup
Docker MongoDB Backup Container based on Alpine w/S6 init, Zabbix Monitoring
Stars: ✭ 27 (-57.81%)
Mutual labels:  s6-overlay
awall
[MIRROR] Alpine firewall configuration tool
Stars: ✭ 37 (-42.19%)
Mutual labels:  alpine-linux
docker-alpine-sshd
A lightweight OpenSSH Docker Image built atop Alpine Linux.
Stars: ✭ 108 (+68.75%)
Mutual labels:  alpine-linux
docker-alpine-pandoc-ja
Pandoc for Japanese based on Alpine Linux
Stars: ✭ 14 (-78.12%)
Mutual labels:  alpine-linux
docker-alpine-nginx-pagespeed
Dockerized Nginx with PageSpeed Module on Alpine Linux
Stars: ✭ 28 (-56.25%)
Mutual labels:  alpine-linux
alpine-conf
[MIRROR] Alpine configuration management scripts
Stars: ✭ 38 (-40.62%)
Mutual labels:  alpine-linux
mkinitfs
[MIRROR] Tool to create initramfs images
Stars: ✭ 37 (-42.19%)
Mutual labels:  alpine-linux

Docker Webstack

Build Status Docker Pulls License

About

This 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 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.

Why?

I can hear you thinking "aren't there already plenty good Nginx / PHP containers out there?". To 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 to start one or more processes in the background. The 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 and makes your container possibly end up with zombie processes.

So I started looking for proper init daemons that can take care of this situation and I found s6-overlay which explains in great detail how they overcame the aforementioned problems.

The goals of this container

  • Be always up to date with the latest packages from Alpine Linux
  • Minimize the lines of code needed in your own Dockerfile and optimize readibility.
  • Have sane defaults for Nginx, PHP, and FPM that can be easily overwritten if needed.

How can I use it?

You can create your own containers based upon this container with a simple FROM in your Dockerfile.

Before you start

Before start hacking away, you should know this:

  • Nginx runs under the system's nginx user, and PHP-FPM runs under the system's php user.
  • The code should be copied into /www, as this is the default directory Nginx and PHP work with in this container.
  • When not using a CMS or framework like Laravel / Symfony / WordPress that brings its own public folder, copy to /www/public instead.
  • 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.

Then there are some tips or rather guidelines that I adhere to personally, but ultimately this is just a matter of taste:

Basic example

Now that we know all that, we can do something like this:

FROM existenz/webstack:7.3

COPY --chown=php:nginx src/ /www

RUN find /www -type d -exec chmod -R 555 {} \; \
    && find /www -type f -exec chmod -R 444 {} \; \
    && find /www/var -type d -exec chmod -R 755 {} \; \
    && find /www/var -type f -exec chmod -R 644 {} \; \
    && apk -U --no-cache add \
    php7-ctype \
    php7-json \
    php7-mbstring

And you should now have a working container that runs your PHP project!

Versions

Tags ending with a -description install packages from different repositories to keep up with the latest PHP versions. These are probably short lived and will be replaced with their default counterpart as soon as these PHP versions make it into the default Alpine repositories. You can use them, just keep in mind you will have to switch over to the default container at one point.

Codecasts containers are no longer provided, see this issue for more information.

See the table below to see what versions are currently available:

Image tag Based on PHP Packages from
5.6 Alpine Linux 3.5 Alpine Linux repo
7.0 Alpine Linux 3.5 Alpine Linux repo
7.1 Alpine Linux 3.7 Alpine Linux repo
7.2 Alpine Linux 3.9 Alpine Linux repo
7.3 Alpine Linux 3.10 Alpine Linux repo
7.4 Alpine Linux 3.13 Alpine Linux repo
8.0 Alpine Linux 3.13 Alpine Linux repo
8.1 Alpine Linux 3.16 Alpine Linux repo
8.1-edge Alpine Linux 3.15 Alpine Linux edge repo

Overriding or extending the configuration

If you want to augment of replace the configuration of Nginx, PHP or FPM, there are multiple options:

  • Place one or more configuration files in specific directories to augment the configuration
  • If that does not suit your needs, you can also simply overwrite the configuration files altogether

These are the files to add or overwrite in order to configure the different parts of the webstack:

Application Copy files into this directory Overwrite this file if needed
PHP core directives (5.6) /etc/php5/conf.d/ /etc/php5/php.ini
PHP-FPM (5.6) /etc/php5/php-fpm.d/ /etc/php5/php-fpm.conf
PHP core directives (7.x) /etc/php7/conf.d/ /etc/php7/php.ini
PHP-FPM (7.x) /etc/php7/php-fpm.d/ /etc/php7/php-fpm.conf
PHP core directives (8.0) /etc/php8/conf.d/ /etc/php8/php.ini
PHP-FPM (8.0) /etc/php8/php-fpm.d/ /etc/php8/php-fpm.conf
PHP core directives (8.1) /etc/php81/conf.d/ /etc/php81/php.ini
PHP-FPM (8.1) /etc/php81/php-fpm.d/ /etc/php81/php-fpm.conf
Nginx /etc/nginx/conf.d/ /etc/nginx/nginx.conf

Bugs, questions, and improvements

If you found a bug or have a question, please open an issue on the GitHub Issue tracker. Improvements can be sent by a Pull Request against the master branch and are greatly appreciated!

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].