我们需要以下的几个软件:
为此需要执行以下的这行命令:
echo '
# install homebrew
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
# install cask
brew tap caskroom/cask
# install java 8
brew cask install java
# install scala
brew install scala
# install pip
sudo easy_install pip
# install script prerequisites
sudo -H pip install docker==2.2.1 ansible==2.3.0.0 jinja2==2.9.6 couchdb==1.1 httplib2==0.9.2 requests==2.10.0' | bash
然后运行起你的 Docker,再到 openwhisk 的目录下,执行:
$ ./gradlew distDocker
期间会下载一些 Jar 包,以及拉 Docker 的镜像:
Download https://jcenter.bintray.com/cz/alenkacz/gradle-scalafmt/1.5.0/gradle-scalafmt-1.5.0.pom
Download https://jcenter.bintray.com/org/codehaus/groovy/groovy-all/2.4.7/groovy-all-2.4.7.pom
Download https://jcenter.bintray.com/com/geirsson/scalafmt-core_2.12/1.2.0/scalafmt-core_2.12-1.2.0.pom
Download https://jcenter.bintray.com/org/scalameta/scalameta_2.12/1.7.0/scalameta_2.12-1.7.0.pom
Download https://jcenter.bintray.com/org/scala-lang/scala-library/2.12.2/scala-library-2.12.2.pom
Download https://jcenter.bintray.com/com/geirsson/metaconfig-core_2.12/0.4.0/metaconfig-core_2.12-0.4.0.pom
Download https://jcenter.bintray.com/com/geirsson/metaconfig-typesafe-config_2.12/0.4.0/metaconfig-typesafe-config_2.12-0.4.0.pom
Download https://jcenter.bintray.com/org/scalameta/parsers_2.12/1.7.0/parsers_2.12-1.7.0.pom
...
期间会下载不同的运行环境:
> Task :actionRuntimes:javaAction:distDocker
Mon Dec 11 07:42:42 CST 2017: Executing 'docker build -t java8action /Users/phodal/test/openwhisk/actionRuntimes/javaAction'
<-------------> 4% EXECUTING [3m 37s]
> :actionRuntimes:javaAction:distDocker
...
<=------------> 9% EXECUTING [9m 41s]
> :actionRuntimes:nodejs6Action:distDocker
这个步骤相当的漫长:
---> 51d1a3f55011
Step 12/17 : ENV JRE_HOME ${JAVA_HOME}/jre
---> Running in 64ee40022706
---> 960b7ac4ed09
Step 13/17 : ENV PATH $JAVA_HOME/bin:$PATH
---> Running in 948602af9e78
---> dbc11dda01c4
Step 14/17 : RUN curl --silent --location --retry 3 --cacert /etc/ssl/certs/GeoTrust_Global_CA.pem --header "Cookie: oraclelicense=accept-securebackup-cookie;" http://download.oracle.com/otn-pub/java/jdk/"${VERSION}"u"${UPDATE}"-b"${BUILD}"/"${SIG}"/jdk-"${VERSION}"u"${UPDATE}"-linux-x64.tar.gz | tar xz -C /tmp && mkdir -p /usr/lib/jvm && mv /tmp/jdk1.${VERSION}.0_${UPDATE} "${JAVA_HOME}" && apt-get autoclean && apt-get --purge -y autoremove && rm -rf /tmp/* /var/tmp/*
---> Running in e476c81ef94a
<=====--------> 39% EXECUTING [24m 27s]
> :common:scala:distDocker
这个步骤大概要五六个小时,直至:
Sending build context to Docker daemon 4.096kB
Step 1/3 : FROM dockerskeleton
---> b87a7e46c988
Step 2/3 : ENV FLASK_PROXY_PORT 8080
---> Using cache
---> f27cd240b189
Step 3/3 : CMD ["/bin/bash", "-c", "tail -f /dev/null"]
---> Running in d785bb3902bd
---> 279f10d8e6ea
Removing intermediate container d785bb3902bd
Successfully built 279f10d8e6ea
Successfully tagged badproxy:latest
> Task :tests:dat:blackbox:badproxy:distDocker
Mon Dec 11 18:56:38 CST 2017: Executing 'docker build -t badproxy /Users/phodal/test/openwhisk/tests/dat/blackbox/badproxy'
Building 'badproxy' took 0.209 seconds
> Task :tests:dat:blackbox:badproxy:tagImage
Mon Dec 11 18:56:38 CST 2017: Executing 'docker tag badproxy whisk/badproxy:latest'
BUILD SUCCESSFUL in 2m 15s
40 actionable tasks: 32 executed, 8 up-to-date
再用 CLI 来执行操作就可以了:
$ bin/wsk action invoke /whisk.system/utils/echo -p message hello --result
{
"message": "hello"
}
围观我的Github Idea墙, 也许,你会遇到心仪的项目