php-pm / php-pm-docker Goto Github PK
View Code? Open in Web Editor NEWDocker files for PHP-PM
Docker files for PHP-PM
The following composer commands fail when the image is built:
composer require php-pm/php-pm:${version} && composer require php-pm/httpkernel-adapter:${http_version}
By default, php-pm/php-pm:${version}
requires the master branch. However, httpkernel-adapter requires php-pm/php-pm: "^1.0"
. This creates a conflict as both versions can't be co-installed.
The 'simple' solution may be to just remove the composer call to install php-pm/php-pm and just let it pull it in as the php-pm/httpkernel-adapter dependency.
Visiting a .php url results in downloading the file instead of running it.
How to reproduce:
#installed symfony cli tool:
sudo mkdir -p /usr/local/bin
sudo curl -LsS https://symfony.com/installer -o /usr/local/bin/symfony
sudo chmod a+x /usr/local/bin/symfony
#create a new symfony 3.4 project:
symfony new blog 3.4
cd blog
composer install --prefer-dist
#run ppm-nginx docker
docker run -v `pwd`:/var/www -p 8080:80 phppm/nginx
#visit .php file:
http://localhost:8080/web/app.php
This results in downloading the .php file and not running the code.
At least we should block downloading of .php and other relevant types. Ideally we should be able to run them.
Thanks
along with some newer php versions builds?
I don't have a lot of experience with Docker & images, but dont know where to look about this problem.
I'm trying to create a custom image starting from phppm/nginx, and then use that image from docker-compose. But when specifing the "command" (debug and static-directory options) is not using them.
# Dockerfile in phpdocker/php-ppm/Dockerfile
FROM phppm/nginx
RUN apk --no-cache add git
RUN apk --no-cache add ca-certificates wget php7-iconv php7-ftp \
&& rm -rf /var/lib/apk/*
# whatever you need
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
After building the image with: docker build phpdocker/php-ppm -t publisher/ppm-ws
Using the previous image within docker-compose: (pay attention to "image")
version: "3.0"
services:
ppm:
image: publisher/ppm-ws:latest
command: --debug=1 --app-env=dev --static-directory=web/
volumes:
- ./:/var/www
ports:
- "1080:80"
Now executing docker-compose up ppm
shows this:
ppm_1 | /var/www
ppm_1 | +---------------------+--------------------------+
ppm_1 | | bridge | HttpKernel |
ppm_1 | | host | 127.0.0.1 |
ppm_1 | | port | 8080 |
ppm_1 | | workers | 8 |
ppm_1 | | app-env | dev |
ppm_1 | | debug | 0 |
ppm_1 | | logging | 1 |
ppm_1 | | static-directory | "" |
ppm_1 | | bootstrap | PHPPM\Bootstraps\Symfony |
ppm_1 | | max-requests | 1000 |
ppm_1 | | populate-server-var | 1 |
ppm_1 | | socket-path | .ppm/run/ |
ppm_1 | | pidfile | .ppm/ppm.pid |
ppm_1 | | cgi-path | /usr/bin/php-cgi7 |
ppm_1 | +---------------------+--------------------------+
ppm_1 | Starting PHP-PM with 8 workers, using StreamSelectLoop ...
Why is not using "static-directory" and "debug"?
Or better yet, how could I change this? Also tried with "environment" within docker-compose without success :(
Thank you guys for this!
When xdebug is configured and my IDE is listening on upcoming connections the problem occurs because a /tmp/dbgKbNLhm
(where new ProcessSlave is created) is not mapped to any path on my host. I could bind a dedicated volume but still my IDE (PHPStorm) does not allow to map paths outside a project.
It is more a question than an issue. Containers on dockerhub looks a bit outdated - maybe it is a good idea to make some automated builds on webhooks? Also supporting more specified tags (with php version - I've tried with updating php version to 7.2 but it is quite complicated) would be nice - many projects require 7.2 php version due to object
typehinting.
I may help, but don't want to make something which won't be accepted later :)
I'm working on building a project to be hosted in Google App Engine with a custom runtime (ie., docker container) based on phppm/docker. However, GAE requires that custom runtimes listen on port 8080:
From the GAE documentation:
Listen to port 8080
The App Engine front end will route incoming requests to the appropriate module on port 8080. You must be sure that your application code is listening on 8080.
It would be nice if the ultimate end port the docker images listened on was configurable from the Dockerfile in our custom container. Perhaps something like this:
FROM phppm/nginx
ENV PPM_LISTEN_ON 8080
COPY web/ /var/www
and then have the PHPPM docker container we are extending automatically configure itself to listen on that port we've set.
Can we update safely to alpine 3.7 instead of current 3.6?
alpine 3.7 ship nodejs v8 in apk, but its v6 in 3.6, it can easy some work.
if it's ok, i can submit a PR
Built skeleton laravel app with:
docker run --rm -it -v /$PWD:/app composer:1.6.1 create-project --prefer-dist laravel/laravel demo3
$ docker pull phppm/nginx
Using default tag: latest
latest: Pulling from phppm/nginx
Digest: sha256:1b96765ad7b0f5cf43e47c41eab4aad26c8d1215c200f1d2fed81a1c7fde5df9
Status: Image is up to date for phppm/nginx:latest
Running with:
$ docker run --rm --name ppm -v /$PWD:/var/www -p 29080:8080 phppm/nginx:latest --debug=1 --app-env=dev --static-directory=web --bootstrap=laravel
/var/www
+---------------------+-------------------+
| bridge | HttpKernel |
| host | 127.0.0.1 |
| port | 8080 |
| workers | 8 |
| app-env | dev |
| debug | 1 |
| logging | 1 |
| static-directory | web |
| bootstrap | laravel |
| max-requests | 1000 |
| populate-server-var | 1 |
| socket-path | /ppm/run |
| pidfile | /ppm/ppm.pid |
| cgi-path | /usr/bin/php-cgi7 |
+---------------------+-------------------+
Starting PHP-PM with 8 workers, using StreamSelectLoop ...
8 workers (starting at 5501) up and ready. Application is ready at http://127.0.0.1:8080/
And no response on port 29080
Inside docker container
/var/www # ls -l
total 166
drwxr-xr-x 2 root root 0 Jan 12 11:42 app
-rwxr-xr-x 1 root root 1686 Jan 12 11:42 artisan
drwxr-xr-x 2 root root 0 Jan 12 11:42 bootstrap
-rwxr-xr-x 1 root root 1413 Jan 12 11:42 composer.json
-rwxr-xr-x 1 root root 143452 Jan 12 11:46 composer.lock
drwxr-xr-x 2 root root 0 Jan 12 11:42 config
drwxr-xr-x 2 root root 0 Jan 12 11:42 database
-rwxr-xr-x 1 root root 1125 Jan 12 11:42 package.json
-rwxr-xr-x 1 root root 1040 Jan 12 11:42 phpunit.xml
drwxr-xr-x 2 root root 0 Jan 12 11:42 public
-rwxr-xr-x 1 root root 3550 Jan 12 11:42 readme.md
drwxr-xr-x 2 root root 0 Jan 12 11:42 resources
drwxr-xr-x 2 root root 0 Jan 12 11:42 routes
-rwxr-xr-x 1 root root 563 Jan 12 11:42 server.php
drwxr-xr-x 2 root root 0 Jan 12 11:42 storage
drwxr-xr-x 2 root root 0 Jan 12 11:42 tests
drwxr-xr-x 2 root root 0 Jan 12 11:46 vendor
-rwxr-xr-x 1 root root 549 Jan 12 11:42 webpack.mix.js
/var/www # ps aux
PID USER TIME COMMAND
1 root 0:00 /bin/bash /etc/app/run.sh --debug=1 --app-env=dev --static-directory=web --bootstrap=laravel
20 root 0:00 nginx: master process nginx
22 nginx 0:00 nginx: worker process
23 nginx 0:00 nginx: worker process
24 nginx 0:00 nginx: worker process
25 nginx 0:00 nginx: worker process
27 root 0:00 php /ppm/vendor/bin/ppm start --ansi --port=8080 --socket-path=/ppm/run --pidfile=/ppm/ppm.pid --static-directory='' --debug=1 --app-env=dev --static-directory=web --bootstrap=laravel
38 root 0:00 /usr/bin/php-cgi7 -C /tmp/dbghKGNEA
39 root 0:00 /usr/bin/php-cgi7 -C /tmp/dbglknBIN
40 root 0:00 /usr/bin/php-cgi7 -C /tmp/dbglejjMf
41 root 0:00 /usr/bin/php-cgi7 -C /tmp/dbgdIlGLk
42 root 0:00 /usr/bin/php-cgi7 -C /tmp/dbgHHlHhl
43 root 0:00 /usr/bin/php-cgi7 -C /tmp/dbgHmiAHl
44 root 0:00 /usr/bin/php-cgi7 -C /tmp/dbgpcJjBg
45 root 0:00 /usr/bin/php-cgi7 -C /tmp/dbgPkCAaI
46 root 0:00 sh
53 root 0:00 ps aux
Everytime we tag a new release, we should build the docker image automatically. Dunno how at the moment. Maybe we can use Github's API and detect when a new tag has been added and then kickstart some build on a buildsystem.
There does not seem to be a latest
tag on docker hub, so you're required to use phppm/nginx:1.0
instead of phppm/nginx
or phppm/nginx:latest
.
Hi,
I'm trying to use (inside docker
) php-pm.
I have a Class '\App\Kernel' not found
when I try to launch my docker container from https://github.com/waghanza/http-benchmark/blob/php_pm/php/laravel/Dockerfile
Does I miss something in composer.json
?
Regards,
I'm struggling to get APP_KERNEL_NAMESPACE changed which is needed here https://github.com/php-pm/php-pm-httpkernel/blob/master/Bootstraps/Symfony.php#L60
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.