forked from apache/openwhisk
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Implement PHP 7.1 kind * Add tests for PHP 7.1 action * Add PHP action documentation Build the Docker container from php:7.1-alpine and implement the HTTP server using PHP's built in server. Note that when using a zip file, the router requires that the `main` function is stored in `index.php`. Note about the runner: The runner sets the exit code to 1 if it has set the last line of stdout to a string suitable for presentation to the user. Therefore, if the exit code is not one, then display a generic message. If there's a runtime error in the action (i.e. not spotted by linter), then looking for the main() function will find it. Render the error to the logs so that the user knows what's happened. Note about vendor folder in a PHP zip: If the PHP vendor file has a vendor directory, then this directory needs to be used rather than the one supplied in the action container. To do this, we require src/vendor/autoload.php which will exist if the zip file contains it. For the two cases where (1) zip file does not contain a vendor folder, or (2) when running a non-binary code action, we move the container's vendor folder into src/.
- Loading branch information
Showing
12 changed files
with
1,068 additions
and
0 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
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,50 @@ | ||
FROM php:7.1-alpine | ||
|
||
RUN \ | ||
|
||
apk update && apk upgrade && \ | ||
|
||
# install dependencies | ||
apk add \ | ||
postgresql-dev \ | ||
icu \ | ||
icu-libs \ | ||
icu-dev \ | ||
freetype-dev \ | ||
libjpeg-turbo-dev \ | ||
libpng-dev \ | ||
libxml2-dev \ | ||
|
||
&& \ | ||
|
||
# install useful PHP extensions | ||
docker-php-ext-install \ | ||
opcache \ | ||
mysqli \ | ||
pdo_mysql \ | ||
pdo_pgsql \ | ||
intl \ | ||
bcmath \ | ||
zip \ | ||
gd \ | ||
soap \ | ||
|
||
&& \ | ||
|
||
# install Composer | ||
cd /tmp && curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/bin --filename=composer | ||
|
||
# create src directory to store action files | ||
RUN mkdir -p /action/src | ||
|
||
# install Composer dependencies | ||
COPY composer.json /action | ||
RUN cd /action && /usr/bin/composer install --no-plugins --no-scripts --prefer-dist --no-dev -o && rm composer.lock | ||
|
||
# copy required files | ||
COPY router.php /action | ||
COPY runner.php /action | ||
|
||
# Run webserver on port 8080 | ||
EXPOSE 8080 | ||
CMD [ "php", "-S", "0.0.0.0:8080", "-d", "expose_php=0", "-d", "html_errors=0", "-d", "error_reporting=E_ALL", "/action/router.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,2 @@ | ||
ext.dockerImageName = 'action-php-v7.1' | ||
apply from: '../../gradle/docker.gradle' |
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 @@ | ||
{ | ||
"config": { | ||
"platform": { | ||
"php": "7.1" | ||
} | ||
}, | ||
"require": { | ||
"guzzlehttp/guzzle": "^6.3", | ||
"ramsey/uuid": "^3.6" | ||
} | ||
} |
Oops, something went wrong.