问题
I want to deploy a node.js workspace on IBM Cloud. The workspace contains a jar file. Is there any other way to deploy a JAR file exceptionally or the JAR gets uploaded along with the node.js files? I am calling the JAR file inside a function. Just wanted to know whether the JAR file gets uploaded or not when I use the following command:
bx cf push
回答1:
Here is the explanation from the Cloud Foundry docs ...
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
Based on this description, your jar file will get pushed. If you want to stop it getting pushed, you could create a temporary .cfignore
file, something like this:
if [[ condition ]]; then
echo my.jar > .cfignore
bx cf push
rm -f .cfignore
else
rm -f .cfignore
bx cf push
fi
If you already have a .cfignore
you your logic will need to either remove or add your jar file to it.
来源:https://stackoverflow.com/questions/49573331/deploying-a-jar-file-on-ibm-cloud