-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* PHP 8.2 Initial commit * Package updates
- Loading branch information
1 parent
aebeab4
commit a5624ab
Showing
11 changed files
with
445 additions
and
4 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
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. | ||
# | ||
--> | ||
|
||
## Initial release | ||
|
||
- Added: PHP: 8.2.8 | ||
- Added: PHP extensions in addition to the standard ones: | ||
- bcmath | ||
- curl | ||
- gd | ||
- intl | ||
- mbstring | ||
- mysqli | ||
- pdo_mysql | ||
- pdo_pgsql | ||
- pdo_sqlite | ||
- soap | ||
- zip | ||
- mongo | ||
- Added: Composer packages: | ||
- [guzzlehttp/guzzle](https://packagist.org/packages/guzzlehttp/guzzle): 7.7.0 | ||
- [ramsey/uuid](https://packagist.org/packages/ramsey/uuid): 4.7.4 |
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,115 @@ | ||
# | ||
# 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. | ||
# | ||
|
||
# build go proxy from source | ||
FROM golang:1.20 AS builder_source | ||
ARG GO_PROXY_GITHUB_USER=apache | ||
ARG GO_PROXY_GITHUB_BRANCH=master | ||
RUN git clone --branch ${GO_PROXY_GITHUB_BRANCH} \ | ||
https://github.com/${GO_PROXY_GITHUB_USER}/openwhisk-runtime-go /src ;\ | ||
cd /src ; env GO111MODULE=on CGO_ENABLED=0 go build main/proxy.go && \ | ||
mv proxy /bin/proxy | ||
|
||
# or build it from a release | ||
FROM golang:1.20 AS builder_release | ||
ARG [email protected] | ||
RUN curl -sL \ | ||
https://github.com/apache/openwhisk-runtime-go/archive/{$GO_PROXY_RELEASE_VERSION}.tar.gz\ | ||
| tar xzf -\ | ||
&& cd openwhisk-runtime-go-*/main\ | ||
&& GO111MODULE=on CGO_ENABLED=0 go build -o /bin/proxy | ||
|
||
FROM php:8.2-cli-bullseye | ||
|
||
# select the builder to use | ||
ARG GO_PROXY_BUILD_FROM=release | ||
|
||
# install PHP extensions | ||
RUN apt-get -y update \ | ||
# Upgrade installed packages to get latest security fixes if the base image does not contain them already. | ||
&& apt-get upgrade -y --no-install-recommends \ | ||
&& apt-get -y install --no-install-recommends \ | ||
unzip \ | ||
libfreetype6 \ | ||
libicu67 \ | ||
libjpeg62-turbo \ | ||
libpng16-16 \ | ||
libssl1.1 \ | ||
libxml2 \ | ||
libzip4 \ | ||
libpq5 \ | ||
zip \ | ||
libfreetype6-dev \ | ||
libicu-dev \ | ||
libjpeg-dev \ | ||
libpng-dev \ | ||
libssl-dev \ | ||
libxml2-dev \ | ||
libzip-dev \ | ||
postgresql-server-dev-13 \ | ||
\ | ||
&& docker-php-ext-install \ | ||
bcmath \ | ||
gd \ | ||
intl \ | ||
mysqli \ | ||
opcache \ | ||
pdo_mysql \ | ||
pdo_pgsql \ | ||
soap \ | ||
zip \ | ||
\ | ||
&& mkdir -p /usr/src/php/ext/mongodb \ | ||
&& curl -fsSL https://pecl.php.net/get/mongodb-1.14.0 | tar xvz -C "/usr/src/php/ext/mongodb" --strip 1 \ | ||
&& docker-php-ext-install -j$(nproc) mongodb \ | ||
\ | ||
&& apt-get purge -y --auto-remove $PHPIZE_DEPS \ | ||
&& apt-get purge -y --auto-remove libfreetype6-dev \ | ||
libicu-dev \ | ||
libjpeg-dev \ | ||
libpng-dev \ | ||
libssl-dev \ | ||
libxml2-dev \ | ||
libzip-dev \ | ||
postgresql-server-dev-13 \ | ||
&& apt-get autoremove -y \ | ||
&& apt-get clean -y \ | ||
&& rm -rf /usr/src/php | ||
|
||
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 along with compile and launcher scripts | ||
RUN mkdir -p /phpAction/action | ||
WORKDIR /phpAction | ||
COPY --from=builder_source /bin/proxy /bin/proxy_source | ||
COPY --from=builder_release /bin/proxy /bin/proxy_release | ||
RUN mv /bin/proxy_${GO_PROXY_BUILD_FROM} /bin/proxy | ||
ADD compile.php /bin/compile.php | ||
ADD runner.php /bin/runner.php | ||
ENV OW_COMPILER=/bin/compile.php | ||
|
||
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-v8.2' | ||
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": "8.2" | ||
} | ||
}, | ||
"require": { | ||
"guzzlehttp/guzzle": "7.7.0", | ||
"ramsey/uuid": "4.7.4" | ||
} | ||
} |
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.