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-nodejs.git


The following commit(s) were added to refs/heads/master by this push:
     new 4369194  Update from source build.
4369194 is described below

commit 436919479bf40c70b861de3185eb9726e3f89aa5
Author: Rodric Rabbah <[email protected]>
AuthorDate: Mon Mar 1 10:36:07 2021 -0500

    Update from source build.
---
 core/typescript37Action/Dockerfile | 29 +++++++++++++++++++++++++----
 1 file changed, 25 insertions(+), 4 deletions(-)

diff --git a/core/typescript37Action/Dockerfile 
b/core/typescript37Action/Dockerfile
index 4b5b0c4..29cc334 100644
--- a/core/typescript37Action/Dockerfile
+++ b/core/typescript37Action/Dockerfile
@@ -15,12 +15,28 @@
 # limitations under the License.
 #
 
-FROM golang:1.12 as builder
-RUN env CGO_ENABLED=0 go get github.com/apache/openwhisk-runtime-go/main \
-    && mv /go/bin/main /bin/proxy
+# build go proxy from source
+FROM golang:1.15 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.15 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 go build -o /bin/proxy
 
 FROM node:12.1.0-stretch
-COPY --from=builder /bin/proxy /bin/proxy
+
+# select the builder to use
+ARG GO_PROXY_BUILD_FROM=release
 
 ENV TYPESCRIPT_VERSION=3.7.4
 ENV OW_COMPILER=/bin/compile
@@ -37,6 +53,11 @@ RUN apt-get update && apt-get install -y \
     && rm -rf /var/lib/apt/lists/* &&\
     mkdir -p /app/action
 
+WORKDIR /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 sources and copy the package.json to root container,
 # so npm packages from user functions take precendence.
 #

Reply via email to