Skip to content

Commit

Permalink
standardize actionloop Dockerfile build steps (apache#81)
Browse files Browse the repository at this point in the history
  • Loading branch information
dgrove-oss authored and rabbah committed Jan 26, 2020
1 parent 873ad2c commit 2b12952
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 21 deletions.
28 changes: 18 additions & 10 deletions core/php7.3Action/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,24 @@
# limitations under the License.
#

FROM golang:1.12 as builder
# build go proxy from source
FROM golang:1.12 AS builder_source
RUN env CGO_ENABLED=0 go get github.com/apache/openwhisk-runtime-go/main && mv /go/bin/main /bin/proxy
#ENV PROXY_SOURCE=https://github.com/apache/openwhisk-runtime-go/archive/golang1.11@1.13.0-incubating.tar.gz
#RUN curl -L "$PROXY_SOURCE" | tar xzf - \
# && mkdir -p src/github.com/apache \
# && mv openwhisk-runtime-go-golang1.11-1.13.0-incubating \
# src/github.com/apache/incubator-openwhisk-runtime-go \
# && cd src/github.com/apache/incubator-openwhisk-runtime-go/main \
# && CGO_ENABLED=0 go build -o /bin/proxy

# or build it from a release
FROM golang:1.12 AS builder_release
ARG GO_PROXY_RELEASE_VERSION=1.12@1.15.0
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 php:7.3.13-cli-stretch

# select the builder to use
ARG GO_PROXY_BUILD_FROM=release

# install dependencies
RUN \
apt-get -y update && \
Expand Down Expand Up @@ -71,10 +77,12 @@ RUN mkdir -p /phpAction/composer
COPY composer.json /phpAction/composer
RUN cd /phpAction/composer && /usr/bin/composer install --no-plugins --no-scripts --prefer-dist --no-dev -o && rm composer.lock

# install proxy binary alogn with compile and launcher scripts
# install proxy binary along with compile and launcher scripts
RUN mkdir -p /phpAction/action
WORKDIR /phpAction
COPY --from=builder /bin/proxy /bin/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 compile /bin/compile
ADD runner.php /bin/runner.php
ENV OW_COMPILER=/bin/compile
Expand Down
28 changes: 18 additions & 10 deletions core/php7.4Action/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,24 @@
# limitations under the License.
#

FROM golang:1.12 as builder
# build go proxy from source
FROM golang:1.12 AS builder_source
RUN env CGO_ENABLED=0 go get github.com/apache/openwhisk-runtime-go/main && mv /go/bin/main /bin/proxy
#ENV PROXY_SOURCE=https://github.com/apache/openwhisk-runtime-go/archive/golang1.11@1.13.0-incubating.tar.gz
#RUN curl -L "$PROXY_SOURCE" | tar xzf - \
# && mkdir -p src/github.com/apache \
# && mv openwhisk-runtime-go-golang1.11-1.13.0-incubating \
# src/github.com/apache/incubator-openwhisk-runtime-go \
# && cd src/github.com/apache/incubator-openwhisk-runtime-go/main \
# && CGO_ENABLED=0 go build -o /bin/proxy

# or build it from a release
FROM golang:1.12 AS builder_release
ARG GO_PROXY_RELEASE_VERSION=1.12@1.15.0
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 php:7.4.1-cli-buster

# select the builder to use
ARG GO_PROXY_BUILD_FROM=release

# install dependencies
RUN \
apt-get -y update && \
Expand Down Expand Up @@ -70,10 +76,12 @@ RUN mkdir -p /phpAction/composer
COPY composer.json /phpAction/composer
RUN cd /phpAction/composer && /usr/bin/composer install --no-plugins --no-scripts --prefer-dist --no-dev -o && rm composer.lock

# install proxy binary alogn with compile and launcher scripts
# install proxy binary along with compile and launcher scripts
RUN mkdir -p /phpAction/action
WORKDIR /phpAction
COPY --from=builder /bin/proxy /bin/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 compile /bin/compile
ADD runner.php /bin/runner.php
ENV OW_COMPILER=/bin/compile
Expand Down
2 changes: 1 addition & 1 deletion gradle/docker.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ if(project.hasProperty('dockerHost')) {
}

if(project.hasProperty('dockerBuildArgs')) {
dockerBuildArgs.each { arg ->
dockerBuildArgs.split(' ').each { arg ->
dockerBuildArg += ['--build-arg', arg]
}
}
Expand Down

0 comments on commit 2b12952

Please sign in to comment.