forked from apache/openwhisk-runtime-php
-
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.
* PHP 7.3 runtime This runtime uses the Go runtime's ActionProxy as the front end. This speeds things up nicely. However, it also means that the detailed error reporting for invalid data being uploaded to /init is not possible as this is handled by the proxy. As a result, the specific tests that this affects have been moved to the PHP 7.1 and 7.2 test classes. Also, it's not possible to send back specific error messages for output with the action proxy, so the fatal error test no longer checks for the specific error text.
- Loading branch information
1 parent
ab65b67
commit 8256de1
Showing
14 changed files
with
580 additions
and
92 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,38 @@ | ||
<!-- | ||
# | ||
# Licensed to the Apache Software Foundation (ASF) under one or more | ||
# contributor license agreements. See the NOTICE file distributed with | ||
# this work for additional information regarding copyright ownership. | ||
# The ASF licenses this file to You under the Apache License, Version 2.0 | ||
# (the "License"); you may not use this file except in compliance with | ||
# the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
--> | ||
|
||
## 1.0.0 | ||
Initial release | ||
|
||
- Added: PHP: 7.3.0 | ||
- Added: PHP extensions in addition to the standard ones: | ||
- bcmath | ||
- curl | ||
- gd | ||
- intl | ||
- mbstring | ||
- mysqli | ||
- pdo_mysql | ||
- pdo_pgsql | ||
- pdo_sqlite | ||
- soap | ||
- zip | ||
- Added: Composer packages: | ||
- [guzzlehttp/guzzle](https://packagist.org/packages/guzzlehttp/guzzle): 6.3.3 | ||
- [ramsey/uuid](https://packagist.org/packages/ramsey/uuid): 3.8.0 |
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,71 @@ | ||
# | ||
# Licensed to the Apache Software Foundation (ASF) under one or more | ||
# contributor license agreements. See the NOTICE file distributed with | ||
# this work for additional information regarding copyright ownership. | ||
# The ASF licenses this file to You under the Apache License, Version 2.0 | ||
# (the "License"); you may not use this file except in compliance with | ||
# the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
|
||
FROM openwhisk/actionloop:410d006 as builder | ||
|
||
FROM php:7.3.0-cli-stretch | ||
|
||
# install dependencies | ||
RUN \ | ||
apt-get -y update && \ | ||
apt-get -y install \ | ||
libfreetype6-dev \ | ||
libicu-dev \ | ||
libicu57 \ | ||
libjpeg-dev \ | ||
libpng-dev \ | ||
libxml2-dev \ | ||
libzip-dev \ | ||
postgresql-server-dev-9.6 \ | ||
unzip \ | ||
zlib1g-dev | ||
|
||
# Install useful PHP extensions | ||
RUN \ | ||
docker-php-ext-install \ | ||
bcmath \ | ||
gd \ | ||
intl \ | ||
mysqli \ | ||
opcache \ | ||
pdo_mysql \ | ||
pdo_pgsql \ | ||
soap \ | ||
zip | ||
|
||
COPY php.ini /usr/local/etc/php | ||
|
||
# install composer | ||
RUN curl -s -f -L -o /tmp/installer.php https://getcomposer.org/installer \ | ||
&& php /tmp/installer.php --no-ansi --install-dir=/usr/bin --filename=composer \ | ||
&& composer --ansi --version --no-interaction --no-plugins --no-scripts | ||
|
||
|
||
# install default Composer dependencies | ||
RUN mkdir -p /phpAction/composer | ||
COPY composer.json /phpAction/composer | ||
RUN cd /phpAction/composer && /usr/bin/composer install --no-plugins --no-scripts --prefer-dist --no-dev -o && rm composer.lock | ||
|
||
# install proxy binary alogn with compile and launcher scripts | ||
RUN mkdir -p /phpAction/action | ||
WORKDIR /phpAction | ||
COPY --from=builder /bin/proxy /bin/proxy | ||
ADD compile /bin/compile | ||
ADD runner.php /bin/runner.php | ||
ENV OW_COMPILER=/bin/compile | ||
|
||
ENTRYPOINT [ "/bin/proxy" ] |
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,19 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
ext.dockerImageName = 'action-php-v7.3' | ||
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,82 @@ | ||
#!/usr/bin/env php | ||
<?php | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
/** | ||
* compile | ||
* | ||
* This file is launched by the action proxy. | ||
* It copies runner.php to right source directory and creates a bash exec script | ||
* that the action proxy will call to start everything off | ||
*/ | ||
|
||
main($argc, $argv); | ||
exit; | ||
|
||
function main($argc, $argv) | ||
{ | ||
if ($argc < 4) { | ||
print("usage: <main-function-name> <source-dir> <bin-dir>"); | ||
exit(1); | ||
} | ||
$main = $argv[1]; | ||
$src = realpath($argv[2]); | ||
$bin = realpath($argv[3]); | ||
|
||
$shim = $bin.'/exec'; | ||
|
||
sources($src); | ||
build($shim, $src, $main); | ||
} | ||
|
||
/** | ||
* Sort out the source code | ||
* | ||
* 1. Copy src/exec to src/index.php if necessary | ||
* 2. Ensure vendor directory exists | ||
*/ | ||
function sources(string $src) | ||
{ | ||
// If the file uploaded by the user is a plain PHP file, then | ||
// the filename will be called exec by the action proxy. | ||
// Rename it to index.php | ||
if (file_exists($src . '/exec')) { | ||
rename($src . '/exec', $src . '/index.php'); | ||
} | ||
|
||
// put vendor in the right place if it doesn't exist | ||
if (!is_dir($src . '/vendor')) { | ||
exec('cp -a /phpAction/composer/vendor ' . escapeshellarg($src . '/vendor')); | ||
} | ||
} | ||
|
||
/** | ||
* Create bin/exec shim | ||
*/ | ||
function build(string $shim, string $src, string $main) : void | ||
{ | ||
$contents = <<<EOT | ||
#!/bin/bash | ||
cd $src | ||
exec php -f /bin/runner.php -- "$main" | ||
EOT; | ||
|
||
file_put_contents($shim, $contents); | ||
chmod($shim, 0755); | ||
} |
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.3" | ||
} | ||
}, | ||
"require": { | ||
"guzzlehttp/guzzle": "6.3.3", | ||
"ramsey/uuid": "3.8.0" | ||
} | ||
} |
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,37 @@ | ||
; Licensed to the Apache Software Foundation (ASF) under one or more | ||
; contributor license agreements. See the NOTICE file distributed with | ||
; this work for additional information regarding copyright ownership. | ||
; The ASF licenses this file to You under the Apache License, Version 2.0 | ||
; (the "License"); you may not use this file except in compliance with | ||
; the License. You may obtain a copy of the License at | ||
; | ||
; http://www.apache.org/licenses/LICENSE-2.0 | ||
; | ||
; Unless required by applicable law or agreed to in writing, software | ||
; distributed under the License is distributed on an "AS IS" BASIS, | ||
; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
; See the License for the specific language governing permissions and | ||
; limitations under the License. | ||
|
||
[PHP] | ||
short_open_tag = Off | ||
output_buffering = Off | ||
expose_php = Off | ||
max_execution_time = 0 | ||
memory_limit = -1 | ||
error_reporting = E_ALL | ||
display_errors = Off | ||
log_errors = On | ||
log_errors_max_len = 0 | ||
html_errors = Off | ||
variables_order = "EGPCS" | ||
request_order = "GP" | ||
post_max_size = 0 | ||
enable_dl = Off | ||
zend.assertions = -1 | ||
|
||
[opcache] | ||
opcache.enable=1 | ||
opcache.enable_cli=1 | ||
opcache.max_accelerated_files=7963 | ||
opcache.validate_timestamps=0 |
Oops, something went wrong.