You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openwhisk.apache.org by ra...@apache.org on 2020/01/26 10:03:31 UTC

[openwhisk-runtime-php] branch master updated: standardize actionloop Dockerfile build steps (#81)

This is an automated email from the ASF dual-hosted git repository.

rabbah pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/openwhisk-runtime-php.git


The following commit(s) were added to refs/heads/master by this push:
     new 2b12952  standardize actionloop Dockerfile build steps (#81)
2b12952 is described below

commit 2b129527cff970d557fa8a9a3ffbcc1d2666495f
Author: David Grove <dg...@users.noreply.github.com>
AuthorDate: Sun Jan 26 05:03:24 2020 -0500

    standardize actionloop Dockerfile build steps (#81)
---
 core/php7.3Action/Dockerfile | 28 ++++++++++++++++++----------
 core/php7.4Action/Dockerfile | 28 ++++++++++++++++++----------
 gradle/docker.gradle         |  2 +-
 3 files changed, 37 insertions(+), 21 deletions(-)

diff --git a/core/php7.3Action/Dockerfile b/core/php7.3Action/Dockerfile
index ddff680..779aaa0 100644
--- a/core/php7.3Action/Dockerfile
+++ b/core/php7.3Action/Dockerfile
@@ -15,18 +15,24 @@
 # limitations under the License.
 #
 
-FROM golang:1.12 as builder
+# build go proxy from source
+FROM golang:1.12 AS builder_source
 RUN env CGO_ENABLED=0 go get github.com/apache/openwhisk-runtime-go/main && mv /go/bin/main /bin/proxy
-#ENV PROXY_SOURCE=https://github.com/apache/openwhisk-runtime-go/archive/golang1.11@1.13.0-incubating.tar.gz
-#RUN curl -L "$PROXY_SOURCE" | tar xzf - \
-#  && mkdir -p src/github.com/apache \
-#  && mv openwhisk-runtime-go-golang1.11-1.13.0-incubating \
-#     src/github.com/apache/incubator-openwhisk-runtime-go \
-#  && cd src/github.com/apache/incubator-openwhisk-runtime-go/main \
-#  && CGO_ENABLED=0 go build -o /bin/proxy
+
+# or build it from a release
+FROM golang:1.12 AS builder_release
+ARG GO_PROXY_RELEASE_VERSION=1.12@1.15.0
+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 go build -o /bin/proxy
 
 FROM php:7.3.13-cli-stretch
 
+# select the builder to use
+ARG GO_PROXY_BUILD_FROM=release
+
 # install dependencies
 RUN \
     apt-get -y update && \
@@ -71,10 +77,12 @@ 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
+# install proxy binary along with compile and launcher scripts
 RUN mkdir -p /phpAction/action
 WORKDIR /phpAction
-COPY --from=builder /bin/proxy /bin/proxy
+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 /bin/compile
 ADD runner.php /bin/runner.php
 ENV OW_COMPILER=/bin/compile
diff --git a/core/php7.4Action/Dockerfile b/core/php7.4Action/Dockerfile
index 7a0ec39..200e917 100644
--- a/core/php7.4Action/Dockerfile
+++ b/core/php7.4Action/Dockerfile
@@ -15,18 +15,24 @@
 # limitations under the License.
 #
 
-FROM golang:1.12 as builder
+# build go proxy from source
+FROM golang:1.12 AS builder_source
 RUN env CGO_ENABLED=0 go get github.com/apache/openwhisk-runtime-go/main && mv /go/bin/main /bin/proxy
-#ENV PROXY_SOURCE=https://github.com/apache/openwhisk-runtime-go/archive/golang1.11@1.13.0-incubating.tar.gz
-#RUN curl -L "$PROXY_SOURCE" | tar xzf - \
-#  && mkdir -p src/github.com/apache \
-#  && mv openwhisk-runtime-go-golang1.11-1.13.0-incubating \
-#     src/github.com/apache/incubator-openwhisk-runtime-go \
-#  && cd src/github.com/apache/incubator-openwhisk-runtime-go/main \
-#  && CGO_ENABLED=0 go build -o /bin/proxy
+
+# or build it from a release
+FROM golang:1.12 AS builder_release
+ARG GO_PROXY_RELEASE_VERSION=1.12@1.15.0
+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 go build -o /bin/proxy
 
 FROM php:7.4.1-cli-buster
 
+# select the builder to use
+ARG GO_PROXY_BUILD_FROM=release
+
 # install dependencies
 RUN \
     apt-get -y update && \
@@ -70,10 +76,12 @@ 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
+# install proxy binary along with compile and launcher scripts
 RUN mkdir -p /phpAction/action
 WORKDIR /phpAction
-COPY --from=builder /bin/proxy /bin/proxy
+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 /bin/compile
 ADD runner.php /bin/runner.php
 ENV OW_COMPILER=/bin/compile
diff --git a/gradle/docker.gradle b/gradle/docker.gradle
index 6ad6850..790c1e1 100644
--- a/gradle/docker.gradle
+++ b/gradle/docker.gradle
@@ -54,7 +54,7 @@ if(project.hasProperty('dockerHost')) {
 }
 
 if(project.hasProperty('dockerBuildArgs')) {
-    dockerBuildArgs.each { arg  ->
+    dockerBuildArgs.split(' ').each { arg  ->
         dockerBuildArg += ['--build-arg', arg]
     }
 }