1. 安装 faas-cli 
参考以前文章,或者使用官方的shell脚本
 
2. 简单例子
mkdir  rong
cd rong
faas-cli new rong --lang python // 默认会有简单的测试code // 生成的项目代码
rong rong.yml template
// 完整目录如下,部分是不需要的,只是一些模板,我们需要的就是Python 的
├── rong
│ ├── handler.py
│ └── requirements.txt
├── rong.yml
└── template
├── csharp
│ ├── Dockerfile
│ ├── function
│ │ ├── Function.csproj
│ │ └── FunctionHandler.cs
│ ├── Program.cs
│ └── root.csproj
├── go
│ ├── Dockerfile
│ ├── function
│ │ └── handler.go
│ └── main.go
├── node
│ ├── build.sh
│ ├── Dockerfile
│ ├── function
│ │ ├── handler.js
│ │ └── package.json
│ ├── index.js
│ └── package.json
├── node-arm64
│ ├── build.sh
│ ├── Dockerfile
│ ├── function
│ │ ├── handler.js
│ │ └── package.json
│ ├── index.js
│ └── package.json
├── node-armhf
│ └── Dockerfile
├── python
│ ├── Dockerfile
│ ├── function
│ │ ├── handler.py
│ │ └── requirements.txt
│ ├── index.py
│ └── requirements.txt
├── python3
│ ├── Dockerfile
│ ├── function
│ │ ├── handler.py
│ │ ├── __init__.py
│ │ └── requirements.txt
│ ├── index.py
│ └── requirements.txt
├── python-armhf
│ └── Dockerfile
└── ruby
├── Dockerfile
├── function
│ ├── Gemfile
│ └── handler.rb
├── Gemfile
└── index.rb // 构建
faas-cli build -f ./rong.yml // 具体的输出
[0] > Building: rong.
Clearing temporary build folder: ./build/rong/
Preparing ./rong/ ./build/rong/function
Building: rong with python template. Please wait..
docker build -t rong .
Sending build context to Docker daemon 6.144kB
Step 1/15 : FROM python:2.7-alpine
---> 9b06bbaac1c7
Step 2/15 : RUN apk --no-cache add curl && echo "Pulling watchdog binary from Github." && curl -sSL https://github.com/openfaas/faas/releases/download/0.6.1/fwatchdog > /usr/bin/fwatchdog && chmod +x /usr/bin/fwatchdog && apk del curl --no-cache
---> Using cache
---> bd048b13c8ba
Step 3/15 : WORKDIR /root/
---> Using cache
---> 54c96a75a92e
Step 4/15 : COPY index.py .
---> Using cache
---> b6f064e7ff22
Step 5/15 : COPY requirements.txt .
---> Using cache
---> c844fec1e035
Step 6/15 : RUN pip install -r requirements.txt
---> Using cache
---> ca4c6044fa4e
Step 7/15 : COPY function function
---> Using cache
---> 5cd07cf272ff
Step 8/15 : RUN touch ./function/__init__.py
---> Using cache
---> 9d4dd7aee98b
Step 9/15 : WORKDIR /root/function/
---> Using cache
---> 4a1374f1c1f5
Step 10/15 : COPY function/requirements.txt .
---> Using cache
---> 8c0facae743b
Step 11/15 : RUN pip install -r requirements.txt
---> Using cache
---> 62943c5906f8
Step 12/15 : WORKDIR /root/
---> Using cache
---> 907178d97644
Step 13/15 : ENV fprocess "python index.py"
---> Using cache
---> d65f459a52a3
Step 14/15 : HEALTHCHECK --interval=1s CMD [ -e /tmp/.lock ] || exit 1
---> Using cache
---> 3e19415c84b6
Step 15/15 : CMD fwatchdog
---> Using cache
---> e85c978e99a4
Successfully built e85c978e99a4
Successfully tagged rong:latest
Image: rong built.
[0] < Builder done. // 发布
faas-cli deploy -f ./rong.yml
// 返回信息如下
Deploying: rong.
No existing service to remove
Deployed.
URL: http://localhost:8080/function/rong 200 OK
3. 使用
  直接点击rong  输入参数,可以看到输出参数
 
 
 
 
 
 

openfaas 简单试用的更多相关文章

  1. jQuery无刷新上传之uploadify简单试用

    先简单的侃两句:貌似已经有两个月的时间没有写过文章了,不过仍会像以前那样每天至少有一至两个小时是泡在园子里看各位大神的文章.前些天在研究“ajax无刷新上传”方面的一些插件,用SWFUpload实现了 ...

  2. cloudevents js sdk 简单试用

    cloudevents 目前官方提供了不同语言的sdk,以下是js 的简单学习试用,从目前来说更新不是很好 clone 代码 git clone https://github.com/cloudeve ...

  3. podium micro-frontends 简单试用

    以下是一个简单的podium 试用,包含了layout 以及podlets,使用docker 运行 podium 主要包含了两大部分 podlets 片段服务 layouts 片段组合服务 环境准备 ...

  4. Visual Studio Code 的简单试用体验

    首先对Visual Studio Code做一个大概的介绍.首先明确一下,这个Visual Studio Code(以下简称 vscode)是一个带GUI的代码编辑器,也就是只能完成简单的代码编辑功能 ...

  5. Cassandra安装及其简单试用

    官方主页:http://cassandra.apache.org/ 简介: The Apache Cassandra Project develops a highly scalable second ...

  6. nginx ngx_http_image_filter_module 简单试用

    nginx包含了一个ngx_http_image_filter_module 模块,我们可以方便的进行图片的缩略图,平时一些简单的功能 已经够用了 环境准备 为了简单使用docker-compose ...

  7. Apigee 简介与简单试用

     Apigee (国内访问需要***)是一家成立于2004年的API管理公司,于2016年9月被Google收购,作为Google云的服务之一.Apigee提供从API设计.开发.管理.门户.网关等 ...

  8. vernemq 集群 docker-compose 搭建简单试用

    vernemq 是一款开源的mqtt broker, 支持cluster 模式部署,而且部署比较简单 以下是一个使用docker-compose 搭建环境的demo 环境准备 docker-compo ...

  9. tailor+ skipper 实现micro-frontends 简单试用

    tailor 在Mosaic 框架中扮演fragment 模版layout的处理,后端fragment可以用任何服务编写 tailor 主要就是进行layout的处理.tailor的是类似facebo ...

随机推荐

  1. Linux图形化界面下使用命令进行截图的方法

    以前在LINUX里面截图都是直接按print screen键或者 alt + print screen. 但是print screen是整个屏幕, alt + print screen是当前窗口. 想 ...

  2. The remote end hung up unexpectedly while git cloning

    https://stackoverflow.com/questions/6842687/the-remote-end-hung-up-unexpectedly-while-git-cloning Qu ...

  3. windchill系统——导航器v1.0:思维导图

    总图 思维导图图片链接 http://www.edrawsoft.cn/viewer/public/s/7b3fc783493788

  4. 利用OPENSSH自身记录密码

    大家都知道,OPENSSH是基于Linux下,一款开源,安全性不错的Linux SSH会话连接工具. 在渗透当中,当我们get root了.我们如何来记录Linux管理员登陆过的SSH? 想法如下: ...

  5. java 实现图片拼接

    1.想要实现多个图片的纵向和横向拼接.实现代码如下 2.补充发现横向拼接的一个bug 宽度没有增加(已修复) 百度地址:工具jar下载 链接:https://pan.baidu.com/s/1uZCN ...

  6. scala学习手记33 - 使用trait进行装饰

    在上一节看到了scala的在实例一级的选择性混入就不得不感叹scala在语法上的扩展性.就通过这样一个特性scala简化了很多在java中的编程概念和设计模式. 比如说在java中常用的组合,以及装饰 ...

  7. mysql 出现Host 'localhost' is not allowed to connect to this MySQL server 错误

    MySql数据库:Host 'localhost' is not allowed to connect to this MySQL server 修改mysql的root密码后,出现Host 'loc ...

  8. DOM冒泡事件

    一.注册事件的三种方式 1 on的方式 语法: 事件源.on+事件名称 = 事件处理程序 例如: btn.onclick = function(){} 细节: 只能注册一个事件处理函数 兼容: 所有主 ...

  9. 网站flash效果遭360急速浏览器拦截

    网站flash效果遭遇360急速浏览器拦截,经分析,本地的一个css文件叫做advertisement.css  结果被360急速浏览器给毙了.改成其他名字就ok了.

  10. 【sparkStreaming】SparkStream的创建

    DStream编程数据模型 DStream(Discretized Stream)作为Spark Streaming的基础抽象,它代表持续性的数据流. 这些数据流既可以通过外部输入源赖获取,也可以通过 ...