问题
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.
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.
How can this be resolved?
回答1:
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
};
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.
For more info, refer to the API docs of the ballerinax/docker
package.
回答2:
Ballerina Quick-tour page is updated with relevant information now.
来源:https://stackoverflow.com/questions/50134123/deploying-the-ballerina-integration-example-in-a-docker-container