在 Docker 容器中部署 Ballerina 集成示例 [英] Deploying the Ballerina integration example in a Docker container
问题描述
在 Ballerina Quick Tour 页面上,有一个关于部署先前创建的在 docker 容器中集成微服务(应该发送推文).
On the Ballerina Quick Tour page, there is an example on deploying a previously created integration microservice (which is supposed to send a Tweet) within in a docker container.
然而,文档的那部分并没有描述如何在容器中打包twitter.toml"(身份验证细节).因此,它不会像未部署在容器中时那样工作.
However, that part of the documentation doesn't describe how to package the "twitter.toml" (authentication details) within the container. Therefore, it doesn't work as it does when it wasn't deployed within a container.
如何解决这个问题?
推荐答案
复制配置文件的部分在那里丢失了.尝试添加 @docker:CopyFiles
注释.以下对我有用:
The piece on copying the config file is missing there. Try adding the @docker:CopyFiles
annotation as well. The following worked for me:
@docker:Config {
registry:"registry.hub.docker.com",
name:"helloballerina",
tag:"v1.0"
}
@docker:CopyFiles {
files: [{source: "./twitter.toml", target: "/opt/twitter.toml", isBallerinaConf: true}]
}
endpoint http:Listener tweetEP {
port: 9090
};
在这里,我选择使用 /opt
作为放置配置文件的目录.您可以在容器中指定所需的路径.isBallerinaConf
字段用于指定要复制的文件是否为配置文件.
Here, I have opted to use /opt
as the directory to place the config file. You can specify a path you want in the container. The isBallerinaConf
field is to specify whether the file to be copied is a configuration file or not.
有关更多信息,请参阅API 文档ballerinax/docker
包.
For more info, refer to the API docs of the ballerinax/docker
package.
这篇关于在 Docker 容器中部署 Ballerina 集成示例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!