Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add initial support for PHP7 * Update PHP env with now an PSR3 logger (Monolog). Now you can also create a handler function with PSR7 Http message and PSR3 logger in parameter. * Add examples for PHP7 environement * For development you can create a function in this path /app/userfuncdev.php it will be loaded * Switch to alpine base image * handler now receive an array with request, response and logger object
- Loading branch information
1 parent
c353e7f
commit 2725da6
Showing
11 changed files
with
517 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
*~ | ||
|
||
# Pycharm IDE | ||
.idea | ||
.idea | ||
environments/php7/vendor/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
FROM php:7.1-alpine | ||
|
||
ENV PATH="/root/.composer/vendor/bin:${PATH}" \ | ||
COMPOSER_ALLOW_SUPERUSER=1 | ||
|
||
RUN echo '#!/bin/sh' > /usr/local/bin/apk-install \ | ||
&& echo 'apk add --update "$@" && rm -rf /var/cache/apk/*' >> /usr/local/bin/apk-install \ | ||
&& chmod +x /usr/local/bin/apk-install | ||
|
||
RUN echo 'http://dl-4.alpinelinux.org/alpine/edge/testing' >> /etc/apk/repositories \ | ||
&& apk update \ | ||
&& apk-install \ | ||
git \ | ||
curl \ | ||
curl-dev \ | ||
libcurl \ | ||
zlib-dev \ | ||
freetype-dev \ | ||
jpeg-dev \ | ||
libjpeg-turbo-dev \ | ||
postgresql-dev \ | ||
libmcrypt-dev \ | ||
libpng-dev \ | ||
icu-dev \ | ||
gettext-dev \ | ||
vim \ | ||
libxml2-dev \ | ||
freetype-dev \ | ||
unzip \ | ||
libc6-compat \ | ||
openssl \ | ||
gcc \ | ||
autoconf | ||
|
||
RUN docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ | ||
|
||
# Install useful extensions | ||
RUN docker-php-ext-install \ | ||
opcache \ | ||
bcmath \ | ||
ctype \ | ||
curl \ | ||
dom \ | ||
iconv \ | ||
fileinfo \ | ||
gd \ | ||
gettext \ | ||
intl \ | ||
json \ | ||
mcrypt \ | ||
mysqli \ | ||
pgsql \ | ||
pcntl \ | ||
pdo \ | ||
ftp \ | ||
pdo_mysql \ | ||
pdo_pgsql \ | ||
phar \ | ||
simplexml \ | ||
xmlrpc \ | ||
zip | ||
|
||
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer | ||
|
||
COPY . /app | ||
WORKDIR /app | ||
|
||
RUN composer install | ||
|
||
EXPOSE 8888 | ||
|
||
ENTRYPOINT ["php"] | ||
CMD ["-S","0.0.0.0:8888","index.php"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
# Fission: PHP Environment | ||
|
||
This is the PHP environment for Fission. | ||
|
||
It's a Docker image containing a PHP 7.1 runtime. This image use php:7.1-cli base image with the built-in PHP server | ||
|
||
This environment didn't force you to use class or create a main function. | ||
|
||
A few common extensions are included : | ||
- curl | ||
- gd | ||
- json | ||
- mcrypt | ||
- PDO (pdo_mysql, pdo_pgsql, pdo_sqlite) | ||
- OPcache | ||
- ftp | ||
- iconv | ||
- phar | ||
- mysqli | ||
- pgsql | ||
- SimpleXML | ||
- xmlrpc | ||
- zip | ||
|
||
## Customizing this image | ||
|
||
To add other extensions or packages(composer.json) you need to edit the Dockerfile and rebuild this image (instructions below). | ||
|
||
## Rebuilding and pushing the image | ||
|
||
You'll need access to a Docker registry to push the image: you can | ||
sign up for Docker hub at hub.docker.com, or use registries from | ||
gcr.io, quay.io, etc. Let's assume you're using a docker hub account | ||
called USER. Build and push the image to the the registry: | ||
|
||
``` | ||
docker build -t USER/php7-env . && docker push USER/php7-env | ||
``` | ||
|
||
## Using the image in fission | ||
|
||
You can add this customized image to fission with "fission env | ||
create": | ||
|
||
``` | ||
fission env create --name php7 --image USER/php7-env | ||
``` | ||
|
||
Or, if you already have an environment, you can update its image: | ||
|
||
``` | ||
fission env update --name php7 --image USER/php7-env | ||
``` | ||
|
||
After this, fission functions that have the env parmeter set to the | ||
same environment name as this command will use this environment. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"autoload": { | ||
"psr-4": { | ||
"PHPEnv\\": "src/" | ||
} | ||
}, | ||
"require": { | ||
"zendframework/zend-diactoros": "^1.3", | ||
"monolog/monolog": "^1.22" | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.