Giter Club home page Giter Club logo

php-pm-docker's Introduction

PHP-PM Docker

You can use PHP-PM using Docker. We provide you several images always with PHP-PM and PHP7 pre-installed.

Images

  • phppm/nginx: Contains php-pm and uses NGiNX as static file serving
  • phppm/standalone: Contains php-pm and uses php-pm's ability to serve static files (slower)
  • phppm/ppm: Just the php-pm binary as entry point

Examples

# change into your project folder first
cd your/symfony-project/

# see what php-pm binary can do for you.
$ docker run -v `pwd`:/var/www/ phppm/ppm --help
$ docker run -v `pwd`:/var/www/ phppm/ppm config --help

# with nginx as static file server
$ docker run -v `pwd`:/var/www -p 8080:80 phppm/nginx

# with php-pm as static file server (dev only)
$ docker run -v `pwd`:/var/www -p 8080:80 phppm/standalone

# use `PPM_CONFIG` environment variable to choose a different ppm config file.
$ docker run  -v `pwd`:/var/www -p 80:80 phppm/nginx -c ppm-prod.json

# enable file tracking, to automatically restart ppm when php source changed
$ docker run -v `pwd`:/var/www -p 80:80 phppm/nginx --debug=1 --app-env=dev

# change static file directory. PPM_STATIC relative to mounted /var/www/.
$ docker run -v `pwd`:/var/www -p 80:80 phppm/nginx --static-directory=web/

# Use 16 threads/workers for PHP-PM.
$ docker run -v `pwd`:/var/www -p 80:80 phppm/nginx --workers=16

Docker compose

version: "3.1"

services:
  ppm:
    image: phppm/nginx
    command: --debug=1 --app-env=dev --static-directory=web/
    volumes:
      - ./symfony-app/:/var/www
    ports:
      - "80:80"

Configuration

You should configure PPM via the ppm.json in the root directory, which is withing the container mounted to /var/www/. Alternatively, you can overwrite each option using the regular cli arguments.

# change the ppm.json within current directory
docker run -v `pwd`:/var/www phppm/ppm config --help

# not persisting config changes
docker run -v `pwd`:/var/www -p 80:80 phppm/nginx --help
docker run -v `pwd`:/var/www -p 80:80 phppm/nginx --workers=1 --debug 1
docker run -v `pwd`:/var/www -p 80:80 phppm/nginx --c prod-ppm.json

Build image with own tools/dependencies

If your applications requires additional php modules or other tools and libraries in your container, you can use our image as base. We use lightweight Alpine Linux.

# Dockerfile
FROM phppm/nginx:1.0

RUN apk --no-cache add git
RUN apk --no-cache add ca-certificates wget

# whatever you need 
docker build vendor/my-image -f Dockerfile .
# now use vendor/my-image instead of `phppm/nginx`

php-pm-docker's People

Contributors

marcj avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.