Some common dependent libraries have been built in various runtimes of SCF, which can be queried in the corresponding runtime development guide:
You can save all the dependent libraries of the SCF code in the code package and upload it to the cloud for use by SCF. SCF supports the following runtimes and usage methods:
Dependency manager: in Node.js, dependencies can be managed with the npm package manager.
Instructions:
package.json
.node_modules
folder by running the npm install
command.Dependency manager: in Python, dependencies can be managed with the pip package manager. For different environment configurations, you can replace pip
with pip3
or pip2
by yourself.
Instructions:
requirements.txt
.pip install -r requirements.txt -t .
command.Note:
- You can run
pip freeze > requirements.txt
to generate therequirements.txt
files for all dependencies in the current environment.- The function runtime environment is CentOS 7, and you need to install the dependencies in the same environment. If not, an error where the dependencies cannot be found may occur while running the function after upload. You can install dependencies as instructed in SCF Container Image.
- If some dependencies involve a dynamic link library, you need to manually copy the relevant dependency package to the dependency installation directory before packaging and uploading them. For more information, please see Installing Dependency with Docker.
Dependency manager: in Java, dependencies can be managed with the Maven package manager.
Instructions:
pom.xml
.maven install
command.Instructions: upload the final binary file when packaging.
SCF provides the following three upload methods for your choice based on your actual needs:
Was this page helpful?