在阿里云上使用函数计算可以通过syaml来配置假设我要在syaml中使用apt安装libc6-dev请给出明确的方案和示例
要在s.yaml中使用apt安装libc6-dev,可以在s.yaml文件中添加以下内容:
ROSTemplateFormatVersion: '2015-09-01'
Transform: 'Aliyun::Serverless-2018-04-03'
Resources:
myFunction:
Type: 'Aliyun::Serverless::Function'
Properties:
Handler: index.handler
Runtime: python3
CodeUri: .
MemorySize: 128
Timeout: 60
EnvironmentVariables:
KEY: VALUE
Dependencies:
- apt
CustomContainerConfig:
Command: ["/bin/bash", "-c", "apt update && apt install -y libc6-dev && exec /usr/local/bin/fcli-invoke-agent"]
这个配置文件中,我们通过在Dependencies中声明apt,使得函数计算在运行时安装了apt。然后在CustomContainerConfig中,通过执行apt update && apt install -y libc6-dev && exec /usr/local/bin/fcli-invoke-agent命令来安装libc6-dev。
其中,exec /usr/local/bin/fcli-invoke-agent是必须的,因为函数计算使用自定义容器时,需要在容器中运行fcli-invoke-agent来与函数计算平台进行通信
原文地址: https://www.cveoy.top/t/topic/gSzu 著作权归作者所有。请勿转载和采集!