Deploy Stable Diffusion WebUI on Alibaba Cloud Function Compute in One Command
This guide walks you through deploying the open‑source Stable Diffusion WebUI on Alibaba Cloud Function Compute using Serverless Devs, covering prerequisites, a single‑line deployment command, configuration details, access URL, and practical tips for handling GPU rendering and cold‑start latency.
Prerequisites
Alibaba Cloud account with Function Compute (FC) enabled.
Container Registry (ACR) service activated.
Serverless Devs CLI installed locally.
Alibaba Cloud access keys configured for Serverless Devs.
One‑Line Deployment
Create a local directory (e.g., stable-diffusion) and add a s.yaml file with the following content:
edition: 1.0.0
name: fc-stable-diffusion
access: default
services:
cn-shanghai-stable-diffusion-sd:
component: devsapp/fc
props:
region: cn-shanghai
service:
description: stable-diffusion部署到函数计算
internetAccess: true
name: stable-diffusion
function:
handler: index.handler
timeout: 600
diskSize: 10240
caPort: 7860
instanceType: fc.gpu.tesla.1
runtime: custom-container
cpu: 8
memorySize: 32768
gpuMemorySize: 16384
name: sd
customContainerConfig:
image: registry.cn-shanghai.aliyuncs.com/vipas/stable-diffusion-web:v2
accelerationType: Default
webServerMode: true
triggers:
- name: defaultTrigger
type: http
qualifier: LATEST
config:
methods: [GET, POST, PUT, DELETE]
authType: anonymous
disableURLInternet: false
customDomains:
- domainName: auto
protocol: HTTP
routeConfigs:
- path: /*Deploy Command
s deployAccessing the Service
After the deployment finishes (cold‑start includes pulling the container image), FC returns an HTTP endpoint similar to:
http://sd.stable-diffusion.xxxxxx.cn-shanghai.fc.devsapp.netReplace xxxxxx with your own account UID. Opening the URL loads the Stable Diffusion WebUI where prompts can be entered to generate images.
Reference Repository
Stable Diffusion WebUI source: https://github.com/AUTOMATIC1111/stable-diffusion-webui
Limitations and Next Steps
The provided container image contains only the base model. Adding additional models requires rebuilding the image.
Cold‑start latency is typically 3–4 minutes because the container image must be pulled and the GPU runtime initialized.
Future improvements may include dynamic model loading, image‑layer caching, and techniques to reduce startup time.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Alibaba Cloud Native
We publish cloud-native tech news, curate in-depth content, host regular events and live streams, and share Alibaba product and user case studies. Join us to explore and share the cloud-native insights you need.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
