Skip to content

Commit 2b12952

Browse files
dgrove-ossrabbah
authored andcommitted
standardize actionloop Dockerfile build steps (#81)
1 parent 873ad2c commit 2b12952

3 files changed

Lines changed: 37 additions & 21 deletions

File tree

core/php7.3Action/Dockerfile

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,24 @@
1515
# limitations under the License.
1616
#
1717

18-
FROM golang:1.12 as builder
18+
# build go proxy from source
19+
FROM golang:1.12 AS builder_source
1920
RUN env CGO_ENABLED=0 go get github.com/apache/openwhisk-runtime-go/main && mv /go/bin/main /bin/proxy
20-
#ENV PROXY_SOURCE=https://github.com/apache/openwhisk-runtime-go/archive/golang1.11@1.13.0-incubating.tar.gz
21-
#RUN curl -L "$PROXY_SOURCE" | tar xzf - \
22-
# && mkdir -p src/github.com/apache \
23-
# && mv openwhisk-runtime-go-golang1.11-1.13.0-incubating \
24-
# src/github.com/apache/incubator-openwhisk-runtime-go \
25-
# && cd src/github.com/apache/incubator-openwhisk-runtime-go/main \
26-
# && CGO_ENABLED=0 go build -o /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
2730

2831
FROM php:7.3.13-cli-stretch
2932

33+
# select the builder to use
34+
ARG GO_PROXY_BUILD_FROM=release
35+
3036
# install dependencies
3137
RUN \
3238
apt-get -y update && \
@@ -71,10 +77,12 @@ RUN mkdir -p /phpAction/composer
7177
COPY composer.json /phpAction/composer
7278
RUN cd /phpAction/composer && /usr/bin/composer install --no-plugins --no-scripts --prefer-dist --no-dev -o && rm composer.lock
7379

74-
# install proxy binary alogn with compile and launcher scripts
80+
# install proxy binary along with compile and launcher scripts
7581
RUN mkdir -p /phpAction/action
7682
WORKDIR /phpAction
77-
COPY --from=builder /bin/proxy /bin/proxy
83+
COPY --from=builder_source /bin/proxy /bin/proxy_source
84+
COPY --from=builder_release /bin/proxy /bin/proxy_release
85+
RUN mv /bin/proxy_${GO_PROXY_BUILD_FROM} /bin/proxy
7886
ADD compile /bin/compile
7987
ADD runner.php /bin/runner.php
8088
ENV OW_COMPILER=/bin/compile

core/php7.4Action/Dockerfile

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,24 @@
1515
# limitations under the License.
1616
#
1717

18-
FROM golang:1.12 as builder
18+
# build go proxy from source
19+
FROM golang:1.12 AS builder_source
1920
RUN env CGO_ENABLED=0 go get github.com/apache/openwhisk-runtime-go/main && mv /go/bin/main /bin/proxy
20-
#ENV PROXY_SOURCE=https://github.com/apache/openwhisk-runtime-go/archive/golang1.11@1.13.0-incubating.tar.gz
21-
#RUN curl -L "$PROXY_SOURCE" | tar xzf - \
22-
# && mkdir -p src/github.com/apache \
23-
# && mv openwhisk-runtime-go-golang1.11-1.13.0-incubating \
24-
# src/github.com/apache/incubator-openwhisk-runtime-go \
25-
# && cd src/github.com/apache/incubator-openwhisk-runtime-go/main \
26-
# && CGO_ENABLED=0 go build -o /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
2730

2831
FROM php:7.4.1-cli-buster
2932

33+
# select the builder to use
34+
ARG GO_PROXY_BUILD_FROM=release
35+
3036
# install dependencies
3137
RUN \
3238
apt-get -y update && \
@@ -70,10 +76,12 @@ RUN mkdir -p /phpAction/composer
7076
COPY composer.json /phpAction/composer
7177
RUN cd /phpAction/composer && /usr/bin/composer install --no-plugins --no-scripts --prefer-dist --no-dev -o && rm composer.lock
7278

73-
# install proxy binary alogn with compile and launcher scripts
79+
# install proxy binary along with compile and launcher scripts
7480
RUN mkdir -p /phpAction/action
7581
WORKDIR /phpAction
76-
COPY --from=builder /bin/proxy /bin/proxy
82+
COPY --from=builder_source /bin/proxy /bin/proxy_source
83+
COPY --from=builder_release /bin/proxy /bin/proxy_release
84+
RUN mv /bin/proxy_${GO_PROXY_BUILD_FROM} /bin/proxy
7785
ADD compile /bin/compile
7886
ADD runner.php /bin/runner.php
7987
ENV OW_COMPILER=/bin/compile

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)