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.
node_modulesfolder by running the
Dependency manager: in Python, dependencies can be managed with the pip package manager. For different environment configurations, you can replace
pip2 by yourself.
pip install -r requirements.txt -t .command.
- You can run
pip freeze > requirements.txtto generate the
requirements.txtfiles 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: upload the final binary file when packaging.
SCF provides the following three upload methods for your choice based on your actual needs: