fn project 私有镜像发布
1. 说明
fnproject 默认的docker registry 是 dockerhub 对于企业应用还是不太方便的
还好系统系统了配置参数方便我们进行配置,与开源harbor 进行集成
2. 使用
a. harbor 安装
此处略过,安装比较简单,参考github 文档即可
b. 配置说明
1. 构建
func.yml
参考配置
NAME:
fn init - create a local func.yaml file
USAGE:
fn init [command options] [FUNCTION_NAME]
DESCRIPTION:
Creates a func.yaml file in the current directory.
OPTIONS:
--name value name of the function. Defaults to directory name.
--force overwrite existing func.yaml
--runtime value choose an existing runtime - .py, .rs, .java, .go, .js, .cs, .fs, .rb, .php
--entrypoint value entrypoint is the command to run to start this function - equivalent to Dockerfile ENTRYPOINT.
--cmd value command to run to start this function - equivalent to Dockerfile CMD.
--version value set initial function version (default: "0.0.1")
--image value, -i value image name
--memory value, -m value memory in MiB (default: 128)
--type value, -t value route type - sync or async
--config value, -c value route configuration
--headers value route response headers
--format value, -f value hot container IO format - default or http (default: "default")
--timeout value route timeout (eg. 30) (default: 30)
--idle-timeout value route idle timeout (eg. 30) (default: 30)
2. deploy
使用 --registry 即可
参考配置
NAME:
fn deploy - deploys a function to the functions server. (bumps, build, pushes and updates route)
USAGE:
fn deploy [command options] [arguments...]
OPTIONS:
--app value app name to deploy to
--verbose, -v verbose mode
--no-cache Don't use Docker cache for the build
--local, --skip-push does not push Docker built images onto Docker Hub - useful for local development.
--registry --registry username Sets the Docker owner for images and optionally the registry. This will be prefixed to your function name for pushing to Docker registries. eg: --registry username will set your Docker Hub owner. `--registry registry.hub.docker.com/username` will set the registry and owner.
--all app.yaml if in root directory containing app.yaml, this will deploy all functions
3. 注意
1. 需要进行 registry 的登录
登录命令为:
docker login registry
2.配置环境变量
FN_REGISTRY
如下:
export FN_REGISTRY=<DOCKERHUB_USERNAME>
4. 参考资料
https://github.com/fnproject/fn
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· 没有源码,如何修改代码逻辑?
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· 记一次.NET内存居高不下排查解决与启示
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· .NET10 - 预览版1新功能体验(一)
2014-10-05 p/Invoke工具