Dependency Installation

Last updated: 2020-03-06 18:03:32

    Built-in Dependencies

    Some common dependent libraries have been built in various runtimes of SCF, which can be queried in the corresponding runtime development guide:

    Installing Dependent Libraries

    You can save 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:

    Node.js runtime

    Dependency manager: In Node.js, dependencies can be managed with the npm package manager.
    Instructions:

    1. Configure dependency information in package.json.
    2. Install the dependent libraries into the node_modules folder with the npm install command.
    3. When uploading the code library, please package and upload the dependent libraries too.

    Python runtime

    Dependency manager: In Python, dependencies can be managed with the pip package manager.
    Instructions:

    1. Configure dependency information in requirements.txt.
    2. Install the dependencies with the pip install -t . command.
    3. When uploading the code library, please package and upload the dependent libraries too.

    Java runtime

    Dependency manager: In Java, dependencies can be managed with the Maven package manager.
    Instructions:

    1. Configure dependency information in pom.xml.
    2. Install the dependencies with the maven install command.
    3. When uploading the code library, please package and upload the dependent libraries too.

    Go runtime

    Instructions: upload the final binary file when packaging.

    Upload Methods

    SCF provides the following three upload methods for your choice based on your actual needs:

    • Deploy a function: you can create a deployment package in your local environment and upload it to SCF, or write the code directly in the SCF Console, which will create and upload the deployment package for you.
    • Create a function with the VS Code plugin: Tencent Serverless Toolkit for VS Code is a plugin for the Visual Studio (VS) Code IDE of Tencent Cloud serverless products. It enables you to better develop serverless projects, debug their code locally, and then deploy them to the cloud with ease.
    • Create a function with CLI: use the command line tool SCF CLI to create a function and deploy it to the cloud.

    Was this page helpful?

    Was this page helpful?

    • Not at all
    • Not very helpful
    • Somewhat helpful
    • Very helpful
    • Extremely helpful
    Send Feedback
    Help