|
| 1 | +# |
| 2 | +# Licensed to the Apache Software Foundation (ASF) under one or more |
| 3 | +# contributor license agreements. See the NOTICE file distributed with |
| 4 | +# this work for additional information regarding copyright ownership. |
| 5 | +# The ASF licenses this file to You under the Apache License, Version 2.0 |
| 6 | +# (the "License"); you may not use this file except in compliance with |
| 7 | +# the License. You may obtain a copy of the License at |
| 8 | +# |
| 9 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | +# |
| 11 | +# Unless required by applicable law or agreed to in writing, software |
| 12 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | +# See the License for the specific language governing permissions and |
| 15 | +# limitations under the License. |
| 16 | +# |
| 17 | + |
| 18 | +# build go proxy from source |
| 19 | +FROM golang:1.20 AS builder_source |
| 20 | +ARG GO_PROXY_GITHUB_USER=apache |
| 21 | +ARG GO_PROXY_GITHUB_BRANCH=master |
| 22 | +RUN git clone --branch ${GO_PROXY_GITHUB_BRANCH} \ |
| 23 | + https://github.com/${GO_PROXY_GITHUB_USER}/openwhisk-runtime-go /src ;\ |
| 24 | + cd /src ; env GO111MODULE=on CGO_ENABLED=0 go build main/proxy.go && \ |
| 25 | + mv proxy /bin/proxy |
| 26 | + |
| 27 | +# or build it from a release |
| 28 | +FROM golang:1.20 AS builder_release |
| 29 | +ARG GO_PROXY_RELEASE_VERSION=1.20@1.22.0 |
| 30 | +RUN curl -sL \ |
| 31 | + https://github.com/apache/openwhisk-runtime-go/archive/{$GO_PROXY_RELEASE_VERSION}.tar.gz\ |
| 32 | + | tar xzf -\ |
| 33 | + && cd openwhisk-runtime-go-*/main\ |
| 34 | + && GO111MODULE=on CGO_ENABLED=0 go build -o /bin/proxy |
| 35 | + |
| 36 | +FROM php:8.2-cli-bullseye |
| 37 | + |
| 38 | +# select the builder to use |
| 39 | +ARG GO_PROXY_BUILD_FROM=release |
| 40 | + |
| 41 | +# install PHP extensions |
| 42 | +RUN apt-get -y update \ |
| 43 | + # Upgrade installed packages to get latest security fixes if the base image does not contain them already. |
| 44 | + && apt-get upgrade -y --no-install-recommends \ |
| 45 | + && apt-get -y install --no-install-recommends \ |
| 46 | + unzip \ |
| 47 | + libfreetype6 \ |
| 48 | + libicu67 \ |
| 49 | + libjpeg62-turbo \ |
| 50 | + libpng16-16 \ |
| 51 | + libssl1.1 \ |
| 52 | + libxml2 \ |
| 53 | + libzip4 \ |
| 54 | + libpq5 \ |
| 55 | + zip \ |
| 56 | + libfreetype6-dev \ |
| 57 | + libicu-dev \ |
| 58 | + libjpeg-dev \ |
| 59 | + libpng-dev \ |
| 60 | + libssl-dev \ |
| 61 | + libxml2-dev \ |
| 62 | + libzip-dev \ |
| 63 | + postgresql-server-dev-13 \ |
| 64 | + \ |
| 65 | + && docker-php-ext-install \ |
| 66 | + bcmath \ |
| 67 | + gd \ |
| 68 | + intl \ |
| 69 | + mysqli \ |
| 70 | + opcache \ |
| 71 | + pdo_mysql \ |
| 72 | + pdo_pgsql \ |
| 73 | + soap \ |
| 74 | + zip \ |
| 75 | + \ |
| 76 | + && mkdir -p /usr/src/php/ext/mongodb \ |
| 77 | + && curl -fsSL https://pecl.php.net/get/mongodb-1.14.0 | tar xvz -C "/usr/src/php/ext/mongodb" --strip 1 \ |
| 78 | + && docker-php-ext-install -j$(nproc) mongodb \ |
| 79 | + \ |
| 80 | + && apt-get purge -y --auto-remove $PHPIZE_DEPS \ |
| 81 | + && apt-get purge -y --auto-remove libfreetype6-dev \ |
| 82 | + libicu-dev \ |
| 83 | + libjpeg-dev \ |
| 84 | + libpng-dev \ |
| 85 | + libssl-dev \ |
| 86 | + libxml2-dev \ |
| 87 | + libzip-dev \ |
| 88 | + postgresql-server-dev-13 \ |
| 89 | + && apt-get autoremove -y \ |
| 90 | + && apt-get clean -y \ |
| 91 | + && rm -rf /usr/src/php |
| 92 | + |
| 93 | +COPY php.ini /usr/local/etc/php |
| 94 | + |
| 95 | +# install composer |
| 96 | +RUN curl -s -f -L -o /tmp/installer.php https://getcomposer.org/installer \ |
| 97 | + && php /tmp/installer.php --no-ansi --install-dir=/usr/bin --filename=composer \ |
| 98 | + && composer --ansi --version --no-interaction --no-plugins --no-scripts |
| 99 | + |
| 100 | +# install default Composer dependencies |
| 101 | +RUN mkdir -p /phpAction/composer |
| 102 | +COPY composer.json /phpAction/composer |
| 103 | +RUN cd /phpAction/composer && /usr/bin/composer install --no-plugins --no-scripts --prefer-dist --no-dev -o && rm composer.lock |
| 104 | + |
| 105 | +# install proxy binary along with compile and launcher scripts |
| 106 | +RUN mkdir -p /phpAction/action |
| 107 | +WORKDIR /phpAction |
| 108 | +COPY --from=builder_source /bin/proxy /bin/proxy_source |
| 109 | +COPY --from=builder_release /bin/proxy /bin/proxy_release |
| 110 | +RUN mv /bin/proxy_${GO_PROXY_BUILD_FROM} /bin/proxy |
| 111 | +ADD compile.php /bin/compile.php |
| 112 | +ADD runner.php /bin/runner.php |
| 113 | +ENV OW_COMPILER=/bin/compile.php |
| 114 | + |
| 115 | +ENTRYPOINT [ "/bin/proxy" ] |
0 commit comments