1414# See the License for the specific language governing permissions and
1515# limitations under the License.
1616#
17- FROM golang:1.12 as builder
18- RUN env CGO_ENABLED=0 go get github.com/apache/openwhisk-runtime-go/main
17+
18+ # build go proxy from source
19+ FROM golang:1.12 AS builder_source
20+ RUN env CGO_ENABLED=0 go get github.com/apache/openwhisk-runtime-go/main && mv /go/bin/main /bin/proxy
21+
22+ # or build it from a release
23+ FROM golang:1.12 AS builder_release
24+ ARG GO_PROXY_RELEASE_VERSION=1.12@1.15.0
25+ RUN curl -sL \
26+ https://github.com/apache/openwhisk-runtime-go/archive/{$GO_PROXY_RELEASE_VERSION}.tar.gz\
27+ | tar xzf -\
28+ && cd openwhisk-runtime-go-*/main\
29+ && GO111MODULE=on go build -o /bin/proxy
1930
2031# Use AdoptOpen JDK8, OpenJ9 release version 0.15.1
2132FROM adoptopenjdk/openjdk8-openj9:x86_64-ubuntu-jdk8u222-b10_openj9-0.15.1
2233
34+ # select the builder to use
35+ ARG GO_PROXY_BUILD_FROM=release
36+
2337RUN rm -rf /var/lib/apt/lists/* && apt-get clean && apt-get update \
2438 && apt-get install -y --no-install-recommends locales python vim \
2539 && rm -rf /var/lib/apt/lists/* \
@@ -36,7 +50,10 @@ RUN locale-gen en_US.UTF-8 ;\
3650 mkdir -p /javaAction/action /usr/java/src /usr/java/lib
3751
3852WORKDIR /javaAction
39- COPY --from=builder /go/bin/main /bin/proxy
53+
54+ COPY --from=builder_source /bin/proxy /bin/proxy_source
55+ COPY --from=builder_release /bin/proxy /bin/proxy_release
56+ RUN mv /bin/proxy_${GO_PROXY_BUILD_FROM} /bin/proxy
4057
4158ADD https://search.maven.org/remotecontent?filepath=com/google/code/gson/gson/2.8.5/gson-2.8.5.jar /usr/java/lib/gson-2.8.5.jar
4259ADD lib/src/Launcher.java /usr/java/src/Launcher.java
0 commit comments