All Projects → phpearth → Docker Php

phpearth / Docker Php

Licence: mit
🐳 Docker For PHP developers - Docker images with PHP, Nginx, OpenLiteSpeed, Apache, Lighttpd, and Alpine

Projects that are alternatives of or similar to Docker Php

Docker Lemp
🐳 Docker 快速搭建 LEMP 开发环境
Stars: ✭ 87 (-63.14%)
Mutual labels:  alpine, nginx
Newznab Tmux
Laravel based usenet indexer
Stars: ✭ 127 (-46.19%)
Mutual labels:  nginx, apache
Dockerweb
A docker-powered bash script for shared web hosting management. The ultimate Docker LAMP/LEMP Stack.
Stars: ✭ 89 (-62.29%)
Mutual labels:  nginx, apache
Dockerfiles
lots of dockerfiles, based on alpine
Stars: ✭ 69 (-70.76%)
Mutual labels:  alpine, nginx
Htconvert
Convert .htaccess redirects to nginx.conf redirects
Stars: ✭ 171 (-27.54%)
Mutual labels:  nginx, apache
Dockerfile
📦 Dockerfiles from WebDevOps for PHP, Apache and Nginx (with PHP5 and PHP7)
Stars: ✭ 1,169 (+395.34%)
Mutual labels:  alpine, nginx
Country Ip Blocks
CIDR country-level IP data, straight from the Regional Internet Registries, updated hourly.
Stars: ✭ 100 (-57.63%)
Mutual labels:  nginx, apache
Netkiller.github.io
Netkiller Free ebook - 免费电子书
Stars: ✭ 861 (+264.83%)
Mutual labels:  nginx, apache
Developer
Gameserver, Voiceserver, Rootserver Webinterface
Stars: ✭ 161 (-31.78%)
Mutual labels:  nginx, apache
Owasp Mth3l3m3nt Framework
OWASP Mth3l3m3nt Framework is a penetration testing aiding tool and exploitation framework. It fosters a principle of attack the web using the web as well as pentest on the go through its responsive interface.
Stars: ✭ 139 (-41.1%)
Mutual labels:  nginx, apache
Fail2ban.webexploits
This custom Fail2Ban filter and jail will deal with all scans for common Wordpress, Joomla and other Web Exploits being scanned for by automated bots and those seeking to find exploitable web sites.
Stars: ✭ 67 (-71.61%)
Mutual labels:  nginx, apache
Goaccess
GoAccess is a real-time web log analyzer and interactive viewer that runs in a terminal in *nix systems or through your browser.
Stars: ✭ 14,096 (+5872.88%)
Mutual labels:  nginx, apache
Ansible Config encoder filters
Ansible role used to deliver the Config Encoder Filters.
Stars: ✭ 48 (-79.66%)
Mutual labels:  nginx, apache
Rare
Fast, realtime regex-extraction, and aggregation into common formats such as histograms, numerical summaries, tables, and more!
Stars: ✭ 76 (-67.8%)
Mutual labels:  nginx, apache
Docs4dev
后端开发常用框架文档及中文翻译,包含 Spring 系列文档(Spring, Spring Boot, Spring Cloud, Spring Security, Spring Session),大数据(Apache Hive, HBase, Apache Flume),日志(Log4j2, Logback),Http Server(NGINX,Apache),Python,数据库(OpenTSDB,MySQL,PostgreSQL)等最新官方文档以及对应的中文翻译。
Stars: ✭ 974 (+312.71%)
Mutual labels:  nginx, apache
Docker Oidc Proxy
Docker Image built on Alpine Linux for secure OpenID Connect (OIDC) proxy authentication
Stars: ✭ 91 (-61.44%)
Mutual labels:  alpine, nginx
Ansible Role Htpasswd
Ansible Role - htpasswd
Stars: ✭ 17 (-92.8%)
Mutual labels:  nginx, apache
Docker Testing
Stars: ✭ 18 (-92.37%)
Mutual labels:  nginx, apache
Serverpilot Letsencrypt
Automate the installation of Let's Encrypt SSL on the free plan of ServerPilot
Stars: ✭ 129 (-45.34%)
Mutual labels:  nginx, apache
Guacamole Install Rhel 7
Apache Guacamole installation bash script for RHEL 7 and CentOS 7 including options for Nginx, HTTPS, SSL, LDAP, Let's Encrypt certificates and more
Stars: ✭ 174 (-26.27%)
Mutual labels:  nginx, apache

Docker for PHP developers

Build Status Docker Automated build MIT License

Carefully crafted Docker images for PHP developers with PHP 7.3, PHP 7.2, PHP 7.1, PHP 7.0, Nginx, OpenLiteSpeed, Apache HTTP Server, and Lighttpd.

PHP.earth

  • Fast and simple PHP extensions installation
  • Optional Composer installation
  • Optional PHPUnit installation
  • runit for running multiple services without overhead
  • Alpine base image with PHP.earth PHP repositories
  • Optimized Docker image sizes
  • Multiple PHP versions

Documentation

Documentation with Docker and PHP recipes is available on PHP.earth.

Docker tags

The following list contains all current Docker tags and what is included in each.

System Docker Tag Features Size
PHP 7.4.0alpha1@Alpine 3.9.4 7.4 Small PHP CLI
7.4-cli PHP CLI
7.4-lighttpd Lighttpd 1.4.52
7.4-litespeed OpenLiteSpeed 1.5.0 RC3
7.4-nginx Nginx 1.14.2, FPM
7.4-apache Apache 2.4.39
7.4-cgi PHP CGI
PHP 7.3.4@Alpine 3.9.3 latest, 7.3 Small PHP CLI
7.3-cli PHP CLI
7.3-lighttpd Lighttpd 1.4.52
7.3-litespeed OpenLiteSpeed 1.5.0 RC3
7.3-nginx Nginx 1.14.2, FPM
7.3-apache Apache 2.4.38
7.3-cgi PHP CGI
PHP 7.2.17@Alpine 3.9.3 7.2 Small PHP CLI
7.2-cli PHP CLI
7.2-lighttpd Lighttpd 1.4.52
7.2-litespeed OpenLiteSpeed 1.5.0 RC3
7.2-nginx Nginx 1.14.2, FPM
7.2-apache Apache 2.4.38
7.2-cgi PHP CGI
PHP 7.1.28@Alpine 3.9.3 7.1 Small PHP CLI
7.1-cli PHP CLI
7.1-lighttpd Lighttpd 1.4.52
7.1-litespeed OpenLiteSpeed 1.5.0 RC3
7.1-nginx Nginx 1.14.2, FPM
7.1-apache Apache 2.4.38
7.1-cgi PHP CGI
PHP 7.0.33@Alpine 3.7.3 7.0 Small PHP CLI
7.0-cli PHP CLI
7.0-lighttpd Lighttpd 1.4.48
7.0-litespeed OpenLiteSpeed 1.5.0 RC3
7.0-nginx Nginx 1.12.2, FPM
7.0-apache Apache 2.4.38
7.0-cgi PHP CGI

Tags follow PHP release cycle and PHP supported versions timeline.

PHP Active Support Until Security Support Until Info
7.4 TBD TBD Development 7.4 branch for testing
7.3 TBD TBD Current recommended branch for production
7.2 2019-11-30 2020-11-20 Previous stable branch
7.1 2018-12-01 2019-12-01 Previous branch for legacy projects
7.0 2017-12-03 2018-12-03 Previous branch for legacy projects, not supported anymore

Quick usage

Nginx

Dockerfile for running Nginx HTTP server with PHP FPM:

FROM phpearth/php:7.3-nginx

Build Docker image and run Docker container:

docker build -t custom-php .
docker run --name custom-php-container -p 80:80 -d custom-php

PHP CLI

To run a CLI PHP script:

docker run -it --rm -v `pwd`:/usr/src/myapp -w /usr/src/myapp phpearth/php php script.php

Composer

To install Composer:

FROM phpearth/php:7.3-nginx

RUN apk add --no-cache composer

PHPUnit

To install PHPUnit:

FROM phpearth/php:7.3-nginx

RUN apk add --no-cache phpunit

OpenLiteSpeed

To run OpenLiteSpeed web server:

FROM phpearth/php:7.3-litespeed

Lighttpd

To run Lighttpd web server:

FROM phpearth/php:7.3-lighttpd

PHP extensions

To install additional PHP extensions, you can use packages from the PHP.earth Alpine repository:

FROM phpearth/php:7.3-nginx

RUN apk add --no-cache php7.3-sodium php7.3-intl php7.3-pdo_mysql

or install them with pecl:

apk add --no-cache php7.3-dev gcc g++
pecl install {extension-name}

PHP ini settings

To configure extra php.ini: settings, create application specific php.ini and copy the file into docker image:

# php.ini
memory_limit = 512M
FROM phpearth/php:7.3-nginx

COPY php.ini $PHP_INI_DIR/conf.d/my-app.ini

Missing extension?

In case you'd need an additional extension in the PHP.earth repository, open an issue.

Docker Stack

Docker Stack is way of orchestration of Docker services and simplifies running multiple services of your application. In this example we'll run an Nginx web server with PHP 7.3 FPM with docker-compose.yml file. In a new project directory create a Dockerfile:

FROM phpearth/php:7.3-nginx

The docker-compose.yml file:

version: '3.3'

services:
  app:
    image: my-dev-image
    volumes:
      - .:/var/www/html
    ports:
      - mode: host
        target: 80
        published: 80

The index.php file:

<?php

phpinfo();

Finally we run:

# Initialize a new Swarm for development
docker swarm init
# Build above image
docker build -t my-dev-image -f Dockerfile .
# Deploy the above stack up and running
docker stack deploy -c docker-compose.yaml mystack

And there should be phpinfo() output visible on http://localhost. Make sure there isn't any other service listening on port 80 before running above command.

PHP 7.0, 7.1, PHP 7.2

To use older versions PHP 7.0, 7.1, or 7.2 use Docker images with 7.0, 7.1, or 7.2:

FROM phpearth/php:7.2-nginx

RUN apk add --no-cache composer

PHP.earth Alpine repository

These Docker images include the latest PHP versions and packages for Alpine Linux via the 3rd party PHP.earth Alpine repository.

FROM alpine:3.8

ADD https://repos.php.earth/alpine/phpearth.rsa.pub /etc/apk/keys/phpearth.rsa.pub
RUN echo "https://repos.php.earth/alpine" >> /etc/apk/repositories \
    && apk add --no-cache php7.3

PHP.earth Alpine packages are prefixed with php7.3, php7.2, php7.1, and php7.0.

Building Images

Images are automatically build on Docker Hub.

Docker Cloud and therefore Docker Hub also provides overriding and customization of various commands when building images automatically.

There are some hooks defined in the docker/hooks folder:

  • hooks/build - executed when building image
  • hooks/post_push - executed after building image, used to push additional tags to Docker Hub.

Labels

Labels are neat way to expose additional metadata about particular Docker object. We use Label Schema when defining image labels:

  • build-date - Date and time of the build. Defined as org.label-schema.build-date=$BUILD_DATE, where $BUILD_DATE is set dynamically via above hooks/build script
  • vcs-url - Repository location on GitHub. Defined as org.label-schema.vcs-url="https://github.com/phpearth/docker-php.git"
  • vcs-ref - Reference to commit in Git repository
  • schema-version - Version of the Label Schema in use.
  • vendor - Vendor name of the image creators.
  • name
  • description
  • url

License and contributing

Contributions are most welcome. This repository is released under the MIT license.

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