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. CSS3自定义发光radiobox单选框

    在线演示 本地下载

  2. 《Python学习手册》(四)

    List and Dictionary 列表: 任意对象的有序集合 通过偏移读取 可变.异构.任意嵌套 常用方法: L.append(object) L.extend(iterable) L.inse ...

  3. Mac & Xcode 技巧

    1.Xcode 删除过期的Provisioning Profile文件 解决:Xcode 中所有的Provisioning Profile文件路径,都在 ~/Library/MobileDevice/ ...

  4. com.android.tools.build:gradle:X.XX.XX:gradle.jar 插件无法下载问题

    在使用Android Studio 这个IDE时,出现com.android.tools.build:gradle:X.XX.XX:gradle.jar 插件无法下载问题 可能的原因就是网速不好或者依 ...

  5. JAVA基础补漏--反射

    获得CLASS的三种方式: 1.Class.forname("全类名"):将字节码文件加载进内存,返回Class对象. 多用于配置文件,将类名放到配置文件中,读取配置文件,加载类 ...

  6. how to create an asp.net web api project in visual studio 2017

    https://docs.microsoft.com/en-us/aspnet/web-api/overview/getting-started-with-aspnet-web-api/tutoria ...

  7. 小米智能家居接入智能家居平台homeassistant的方法

    [原文] 在安装和设置完homeassistant之后,我们终于来到激动人心的一步——把智能家居产品接入homeassistant了.把智能家居产品接入homeassistant智能家居平台之后,就可 ...

  8. Find Min In Rotated Sorted Array2,包含重复数字的反转序列找最小值。

    public int findMin(int[] nums) { return findMin(nums, 0, nums.length - 1); } public int findMin(int[ ...

  9. NumPy IO文件操作

    NumPy - IO ndarray对象可以保存到磁盘文件并从磁盘文件加载. 可用的 IO 功能有: load()和save()函数处理 numPy 二进制文件(带npy扩展名) loadtxt()和 ...

  10. 连接mysql报错:error 2003 (hy000):can't connect to mysql server on 'localhost' (10061)

    一.mysql 的bin目录下有个MySQLInstanceConfig.exe,运行就可以进行创建数据库实例,创建实例时也可以生成windows 服务,把服务设置成自动启动就可以了 二.安装在D盘的 ...