我想在 IBM Cloud 上部署一个 node.js 工作区。工作区包含一个 jar 文件。是否有其他方法可以异常部署 JAR 文件或者 JAR 与 node.js 文件一起上传?我在函数内调用 JAR 文件。 只是想知道当我使用以下命令时 JAR 文件是否上传:
bx cf push
最佳答案
这是 Cloud Foundry 文档的解释...
How cf push Finds the Application
By default, cf push recursively pushes the contents of the current working directory. Alternatively, you can provide a path using either a manifest or a command line option.
If the path is to a directory, cf push recursively pushes the contents of that directory instead of the current working directory. If the path is to a file, cf push pushes only that file.
Note: If you want to push more than a single file, but not the entire contents of a directory, consider using a .cfignore file to tell cf push what to exclude.
Source: https://docs.cloudfoundry.org/devguide/deploy-apps/manifest.html
根据此描述,您的 jar 文件将被推送。如果您想阻止它被推送,您可以创建一个临时 .cfignore
文件,如下所示:
if [[ condition ]]; then
echo my.jar > .cfignore
bx cf push
rm -f .cfignore
else
rm -f .cfignore
bx cf push
fi
如果您已经有 .cfignore
,您的逻辑将需要删除或添加您的 jar 文件。
关于java - 在 IBM Cloud 上部署 JAR 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49573331/