Skip to content

Commit

Permalink
Squashed commit of the following:
Browse files Browse the repository at this point in the history
commit 30ae09b
Author: OhYee <[email protected]>
Date:   Mon Oct 30 09:08:44 2023 +0800

    release v10

commit e33e212
Author: 孔晨皓(鸥弋)(OhYee) <[email protected]>
Date:   Sun Oct 29 00:24:28 2023 +0800

    feat: set default filemgr version to 1.2.1

commit ec1f7da
Author: OhYee <[email protected]>
Date:   Thu Oct 26 03:34:51 2023 -0500

    use filemgr 1.2.0

commit 9943605
Author: OhYee <[email protected]>
Date:   Wed Oct 25 16:59:08 2023 +0800

    support lite version

commit 5fa1d99
Author: OhYee <[email protected]>
Date:   Wed Oct 25 16:50:01 2023 +0800

    set japan as default region

commit 00f51b2
Author: OhYee <[email protected]>
Date:   Tue Oct 24 17:16:17 2023 +0800

    fix: release all three packages

commit 0e209cb
Author: OhYee <[email protected]>
Date:   Tue Oct 24 17:10:32 2023 +0800

    download filemgr before deploy

commit d9ebc66
Author: OhYee <[email protected]>
Date:   Tue Oct 24 16:56:50 2023 +0800

    add ap-south-east-1

commit c6a1738
Author: OhYee <[email protected]>
Date:   Tue Oct 24 14:51:52 2023 +0800

    release v9
  • Loading branch information
OhYee committed Oct 30, 2023
1 parent b70e0dc commit 8400fa9
Show file tree
Hide file tree
Showing 1,426 changed files with 535 additions and 377,647 deletions.
54 changes: 0 additions & 54 deletions .github/workflows/registry-publish.yml

This file was deleted.

56 changes: 56 additions & 0 deletions .github/workflows/release-dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: release dev version to serverless-hub

on:
push:
branches:
- master
- main
- dev
- 'dev/**'

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'
- uses: actions/setup-node@v1
with:
node-version: 12
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
pip install requests
- name: NPM install
run: |
npm install --production
- name: Add publish file
run: |
wget https://serverless-registry.oss-cn-hangzhou.aliyuncs.com/publish-file/python3/hub-publish.py
ls
- name: Publish package
env:
publish_token: ${{ secrets.alibaba_registry_publish_token }}
run: |
export TAG="dev"
echo "release fc-stable-diffusion"
sed -i "s/Version: .*/Version: ${TAG}/" publish.yaml
python hub-publish.py
echo "release fc-stable-diffusion-plus"
mv publish-plus.yaml publish.yaml
mv readme-plus.md readme.md
sed -i "s/Version: .*/Version: ${TAG}/" publish.yaml
python hub-publish.py
echo "release fc-stable-diffusion-api"
mv publish-api.yaml publish.yaml
mv readme-api.md readme.md
sed -i "s/Version: .*/Version: ${TAG}/" publish.yaml
python hub-publish.py
83 changes: 83 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
name: release package to serverless-hub

on:
release:
types: [created]

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'
- uses: actions/setup-node@v1
with:
node-version: 12
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
pip install requests
- name: NPM install
run: |
npm install --production
- name: Add publish file
run: |
wget https://serverless-registry.oss-cn-hangzhou.aliyuncs.com/publish-file/python3/hub-publish.py
ls
- name: Publish package
env:
publish_token: ${{ secrets.alibaba_registry_publish_token }}
release_body: ${{ github.event.release.body }}
release_name: ${{ github.event.release.name }}
run: |
if [[ -e "${release_body}" ]]; then
TAG=$(git describe --tags --always | sed 's/^v//')
echo "release ${TAG}"
echo "release fc-stable-diffusion"
sed -i "s/Version: .*/Version: ${TAG}/" publish.yaml
python hub-publish.py
echo "release fc-stable-diffusion-plus"
mv publish-plus.yaml publish.yaml
mv readme-plus.md readme.md
sed -i "s/Version: .*/Version: ${TAG}/" publish.yaml
python hub-publish.py
echo "release fc-stable-diffusion-api"
mv publish-api.yaml publish.yaml
mv readme-api.md readme.md
sed -i "s/Version: .*/Version: ${TAG}/" publish.yaml
python hub-publish.py
else
if [[ -n $(echo "$release_name $release_body" | grep -P 'fc-stable-diffusion(?!-)') ]]; then
echo "release fc-stable-diffusion"
python hub-publish.py
fi
if [[ -n $(echo "$release_name $release_body" | grep -P 'fc-stable-diffusion-plus') ]]; then
echo "release fc-stable-diffusion-plus"
mv publish-plus.yaml publish.yaml
mv readme-plus.md readme.md
python hub-publish.py
fi
if [[ -n $(echo "$release_name $release_body" | grep -P 'fc-stable-diffusion-api') ]]; then
echo "release fc-stable-diffusion-api"
mv publish-api.yaml publish.yaml
mv readme-api.md readme.md
python hub-publish.py
fi
fi
5 changes: 3 additions & 2 deletions publish-api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Type: Application
Name: fc-stable-diffusion-api
Provider:
- 阿里云
Version: 1.0.10
Version: dev
Description: 使用serverless devs将stable-diffusion-api部署到阿里云函数计算上
HomePage: https://github.com/OhYee/fc-stable-diffuson
Tags: #标签详情
Expand All @@ -29,6 +29,7 @@ Parameters:
description: 创建应用所在的地区。由于当前模板涉及 Github 以及 HuggingFace 等网站访问,国内部分地区可能无法直接使用,推荐您选择海外地区进行部署
enum:
- ap-northeast-1
- ap-southeast-1
- cn-beijing
- cn-hangzhou
- cn-shanghai
Expand Down Expand Up @@ -59,7 +60,7 @@ Parameters:
- SD1.5
- 动漫风格
- 真人风格

- 轻量版
nasEnabled:
title: 启用 NAS
type: boolean
Expand Down
5 changes: 3 additions & 2 deletions publish-plus.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Type: Application
Name: fc-stable-diffusion-plus
Provider:
- 阿里云
Version: 1.0.10
Version: dev
Description: 使用serverless devs将stable-diffusion-plus部署到阿里云函数计算上
HomePage: https://github.com/OhYee/fc-stable-diffuson
Tags: #标签详情
Expand All @@ -29,6 +29,7 @@ Parameters:
description: 创建应用所在的地区。由于当前模板涉及 Github 以及 HuggingFace 等网站访问,国内部分地区可能无法直接使用,推荐您选择海外地区进行部署
enum:
- ap-northeast-1
- ap-southeast-1
- cn-beijing
- cn-hangzhou
- cn-shanghai
Expand Down Expand Up @@ -59,7 +60,7 @@ Parameters:
- SD1.5
- 动漫风格
- 真人风格

- 轻量版
nasEnabled:
title: 启用 NAS
type: boolean
Expand Down
4 changes: 3 additions & 1 deletion publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Type: Application
Name: fc-stable-diffusion
Provider:
- 阿里云
Version: 1.0.10
Version: dev
Description: 使用serverless devs将stable-diffusion部署到阿里云函数计算上
HomePage: https://github.com/OhYee/fc-stable-diffuson
Tags: #标签详情
Expand All @@ -25,6 +25,7 @@ Parameters:
description: 创建应用所在的地区。由于当前模板涉及 Github 以及 HuggingFace 等网站访问,国内部分地区可能无法直接使用,推荐您选择海外地区进行部署
enum:
- ap-northeast-1
- ap-southeast-1
- cn-beijing
- cn-hangzhou
- cn-shanghai
Expand Down Expand Up @@ -53,6 +54,7 @@ Parameters:
- SD1.5
- 动漫风格
- 真人风格
- 轻量版
enableCollect:
title: 协助改善体验
type: boolean
Expand Down
44 changes: 27 additions & 17 deletions src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,29 +13,33 @@ help: ## 帮助文件

NAMESPACE=aliyun-fc
REPO=fc-stable-diffusion
BASE_TAG=basev6
BASE_TAG=basev8

SD15_VERSION=v8
ANIME_VERSION=v8
REALMAN_VERSION=v8
SD15_VERSION=v10
ANIME_VERSION=v10
REALMAN_VERSION=v10
LITE_VERSION=v2


push: push-beijing push-shanghai push-shenzhen push-hangzhou ## push 镜像到所有 registry
push: push-jp push-beijing push-shanghai push-shenzhen push-hangzhou ## push 镜像到所有 registry


build-base: ## 构建基础镜像
DOCKER_BUILDKIT=1 docker build -f code/images/Dockerfile --target base -t registry.cn-hangzhou.aliyuncs.com/${NAMESPACE}/${REPO}:${BASE_TAG} code/images

build-sd1.5: ## 构建 sd 1.5
DOCKER_BUILDKIT=1 docker build -f code/images/Dockerfile --target sd1.5 -t stable-diffusion:sd1.5-${SD15_VERSION} code/images/
DOCKER_BUILDKIT=1 docker build -f code/images/Dockerfile --target sd1.5 --build-arg IMAGE_TAG=sd1.5-${SD15_VERSION} -t stable-diffusion:sd1.5-${SD15_VERSION} code/images/

build-anime: ## 构建动漫风格
DOCKER_BUILDKIT=1 docker build -f code/images/Dockerfile --target anime -t stable-diffusion:anime-${ANIME_VERSION} code/images/
DOCKER_BUILDKIT=1 docker build -f code/images/Dockerfile --target anime --build-arg IMAGE_TAG=anime-${ANIME_VERSION} -t stable-diffusion:anime-${ANIME_VERSION} code/images/

build-realman: ## 构建真人风格
DOCKER_BUILDKIT=1 docker build -f code/images/Dockerfile --target realman -t stable-diffusion:realman-${REALMAN_VERSION} code/images/
DOCKER_BUILDKIT=1 docker build -f code/images/Dockerfile --target realman --build-arg IMAGE_TAG=realman-${REALMAN_VERSION} -t stable-diffusion:realman-${REALMAN_VERSION} code/images/

build: build-sd1.5 build-anime build-realman # 构建全部镜像
build-lite: ## 构建 Lite 版本
DOCKER_BUILDKIT=1 docker build -f code/images/Dockerfile --target lite --build-arg IMAGE_TAG=lite-${LITE_VERSION} -t stable-diffusion:lite-${LITE_VERSION} code/images/

build: build-sd1.5 build-anime build-realman build-lite # 构建全部镜像



Expand All @@ -45,42 +49,42 @@ push-base: ## 推送基础镜像

push-beijing: ## push 镜像到北京
IMAGE=registry.cn-beijing.aliyuncs.com/${NAMESPACE}/${REPO} && \
for tag in "sd1.5-${SD15_VERSION}" "anime-${ANIME_VERSION}" "realman-${REALMAN_VERSION}"; do \
for tag in "sd1.5-${SD15_VERSION}" "anime-${ANIME_VERSION}" "realman-${REALMAN_VERSION}" "lite-${LITE_VERSION}"; do \
docker tag stable-diffusion:$$tag $$IMAGE:$$tag && \
docker push $$IMAGE:$$tag; \
done

push-shanghai: ## push 镜像到上海
IMAGE=registry.cn-shanghai.aliyuncs.com/${NAMESPACE}/${REPO} && \
for tag in "sd1.5-${SD15_VERSION}" "anime-${ANIME_VERSION}" "realman-${REALMAN_VERSION}"; do \
for tag in "sd1.5-${SD15_VERSION}" "anime-${ANIME_VERSION}" "realman-${REALMAN_VERSION}" "lite-${LITE_VERSION}"; do \
docker tag stable-diffusion:$$tag $$IMAGE:$$tag && \
docker push $$IMAGE:$$tag; \
done

push-shenzhen: ## push 镜像到深圳
IMAGE=registry.cn-shenzhen.aliyuncs.com/${NAMESPACE}/${REPO} && \
for tag in "sd1.5-${SD15_VERSION}" "anime-${ANIME_VERSION}" "realman-${REALMAN_VERSION}"; do \
for tag in "sd1.5-${SD15_VERSION}" "anime-${ANIME_VERSION}" "realman-${REALMAN_VERSION}" "lite-${LITE_VERSION}"; do \
docker tag stable-diffusion:$$tag $$IMAGE:$$tag && \
docker push $$IMAGE:$$tag; \
done

push-hangzhou: ## push 镜像到杭州
IMAGE=registry.cn-hangzhou.aliyuncs.com/${NAMESPACE}/${REPO} && \
for tag in "sd1.5-${SD15_VERSION}" "anime-${ANIME_VERSION}" "realman-${REALMAN_VERSION}"; do \
for tag in "sd1.5-${SD15_VERSION}" "anime-${ANIME_VERSION}" "realman-${REALMAN_VERSION}" "lite-${LITE_VERSION}"; do \
docker tag stable-diffusion:$$tag $$IMAGE:$$tag && \
docker push $$IMAGE:$$tag; \
done

push-ap: build ## push 镜像到新加坡
IMAGE=registry-vpc.ap-southeast-1.aliyuncs.com/${NAMESPACE}/${REPO} && \
for tag in "sd1.5-${SD15_VERSION}" "anime-${ANIME_VERSION}" "realman-${REALMAN_VERSION}"; do \
for tag in "sd1.5-${SD15_VERSION}" "anime-${ANIME_VERSION}" "realman-${REALMAN_VERSION}" "lite-${LITE_VERSION}"; do \
docker tag stable-diffusion:$$tag $$IMAGE:$$tag && \
docker push $$IMAGE:$$tag; \
done

push-jp:
IMAGE=registry.ap-northeast-1.aliyuncs.com/${NAMESPACE}/${REPO} && \
for tag in "sd1.5-${SD15_VERSION}" "anime-${ANIME_VERSION}" "realman-${REALMAN_VERSION}"; do \
for tag in "sd1.5-${SD15_VERSION}" "anime-${ANIME_VERSION}" "realman-${REALMAN_VERSION}" "lite-${LITE_VERSION}"; do \
docker tag stable-diffusion:$$tag $$IMAGE:$$tag && \
docker push $$IMAGE:$$tag; \
done
Expand All @@ -93,7 +97,7 @@ sync-from-ap: ## 同步新加坡镜像到其他 region
docker pull registry.ap-southeast-1.aliyuncs.com/${NAMESPACE}/${REPO}:${BASE_TAG} && \
docker tag registry.ap-southeast-1.aliyuncs.com/${NAMESPACE}/${REPO}:${BASE_TAG} registry.cn-hangzhou.aliyuncs.com/${NAMESPACE}/${REPO}:${BASE_TAG} && \
docker push registry.cn-hangzhou.aliyuncs.com/${NAMESPACE}/${REPO}:${BASE_TAG} && \
for tag in "sd1.5-${SD15_VERSION}" "anime-${ANIME_VERSION}" "realman-${REALMAN_VERSION}"; do \
for tag in "sd1.5-${SD15_VERSION}" "anime-${ANIME_VERSION}" "realman-${REALMAN_VERSION}" "lite-${LITE_VERSION}"; do \
for region in "cn-hangzhou" "cn-beijing" "cn-shanghai" "cn-shenzhen" "ap-northeast-1"; do \
docker pull registry.ap-southeast-1.aliyuncs.com/${NAMESPACE}/${REPO}:$${tag} && \
docker tag registry.ap-southeast-1.aliyuncs.com/${NAMESPACE}/${REPO}:$${tag} registry.$${region}.aliyuncs.com/${NAMESPACE}/${REPO}:$${tag} && \
Expand All @@ -106,4 +110,10 @@ push: push-beijing push-shanghai push-hangzhou push-shenzhen push-jp

all-ap: build-base build push-base-ap push-ap

all: all-ap push-base push
all: all-ap push push-base

dev: build-anime ## 使用动漫风格进行测试
docker run --rm -it --name=sd --net=host -v ${shell pwd}/nas:/mnt/auto stable-diffusion:anime-${ANIME_VERSION}

exec: ## 登入容器实例
docker exec -it sd /bin/bash
Loading

0 comments on commit 8400fa9

Please sign in to comment.