Skip to content

Commit 785aab7

Browse files
dgrove-ossrabbah
authored andcommitted
standardize actionloop Dockerfile build logic (#106)
1 parent 279992d commit 785aab7

2 files changed

Lines changed: 21 additions & 4 deletions

File tree

core/java8actionloop/Dockerfile

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,26 @@
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
2132
FROM 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+
2337
RUN 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

3852
WORKDIR /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

4158
ADD 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
4259
ADD lib/src/Launcher.java /usr/java/src/Launcher.java

gradle/docker.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ if(project.hasProperty('dockerHost')) {
5454
}
5555

5656
if(project.hasProperty('dockerBuildArgs')) {
57-
dockerBuildArgs.each { arg ->
57+
dockerBuildArgs.split(' ').each { arg ->
5858
dockerBuildArg += ['--build-arg', arg]
5959
}
6060
}

0 commit comments

Comments
 (0)