1515# limitations under the License.
1616#
1717
18- FROM golang:1.12 as builder
19- RUN env CGO_ENABLED=0 go get github.com/apache/openwhisk-runtime-go/main \
20- && mv /go/bin/main /bin/proxy
18+ # build go proxy from source
19+ FROM golang:1.15 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.15 AS builder_release
29+ ARG GO_PROXY_RELEASE_VERSION=1.15@1.17.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 go build -o /bin/proxy
2135
2236FROM node:12.1.0-stretch
23- COPY --from=builder /bin/proxy /bin/proxy
37+
38+ # select the builder to use
39+ ARG GO_PROXY_BUILD_FROM=release
2440
2541ENV TYPESCRIPT_VERSION=3.7.4
2642ENV OW_COMPILER=/bin/compile
@@ -37,6 +53,11 @@ RUN apt-get update && apt-get install -y \
3753 && rm -rf /var/lib/apt/lists/* &&\
3854 mkdir -p /app/action
3955
56+ WORKDIR /proxy
57+ COPY --from=builder_source /bin/proxy /bin/proxy_source
58+ COPY --from=builder_release /bin/proxy /bin/proxy_release
59+ RUN mv /bin/proxy_${GO_PROXY_BUILD_FROM} /bin/proxy
60+
4061# Add sources and copy the package.json to root container,
4162# so npm packages from user functions take precendence.
4263#
0 commit comments