feat: 新增TenantUI主分支自动发布流水线
Some checks failed
Build and Deploy TenantUI / build-and-deploy (push) Failing after 1s
Some checks failed
Build and Deploy TenantUI / build-and-deploy (push) Failing after 1s
This commit is contained in:
57
.gitea/workflows/deploy.yml
Normal file
57
.gitea/workflows/deploy.yml
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
name: Build and Deploy TenantUI
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build-and-deploy:
|
||||||
|
runs-on: host
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
run: |
|
||||||
|
set -e
|
||||||
|
cd /opt/deploy/tenantui || mkdir -p /opt/deploy/tenantui
|
||||||
|
cd /opt/deploy/tenantui
|
||||||
|
|
||||||
|
# 如果已有仓库就 pull,否则 clone
|
||||||
|
if [ -d ".git" ]; then
|
||||||
|
git fetch origin main
|
||||||
|
git reset --hard origin/main
|
||||||
|
git clean -fd
|
||||||
|
else
|
||||||
|
git clone --branch main ssh://git@git.laosankeji.com:2222/msumshk/TakeoutSaaS.TenantUI.git .
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: Build on host
|
||||||
|
run: |
|
||||||
|
set -e
|
||||||
|
cd /opt/deploy/tenantui
|
||||||
|
corepack enable
|
||||||
|
pnpm install --frozen-lockfile
|
||||||
|
VITE_GLOB_API_URL=https://api-tenant-dev.laosankeji.com/api/tenant/v1 pnpm run build:antd
|
||||||
|
|
||||||
|
rm -rf publish/web-antd-dist
|
||||||
|
mkdir -p publish
|
||||||
|
cp -r apps/web-antd/dist publish/web-antd-dist
|
||||||
|
|
||||||
|
- name: Build Docker image
|
||||||
|
run: |
|
||||||
|
set -e
|
||||||
|
cd /opt/deploy/tenantui
|
||||||
|
docker build -t takeoutsaas-tenantui:latest -f scripts/deploy/Dockerfile.runtime .
|
||||||
|
|
||||||
|
- name: Deploy container
|
||||||
|
run: |
|
||||||
|
docker stop tenantui || true
|
||||||
|
docker rm tenantui || true
|
||||||
|
docker run -d \
|
||||||
|
--name tenantui \
|
||||||
|
--restart unless-stopped \
|
||||||
|
-p 8010:8080 \
|
||||||
|
takeoutsaas-tenantui:latest
|
||||||
|
|
||||||
|
- name: Clean up old images
|
||||||
|
run: |
|
||||||
|
docker image prune -f
|
||||||
16
scripts/deploy/Dockerfile.runtime
Normal file
16
scripts/deploy/Dockerfile.runtime
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
FROM nginx:stable-alpine AS runtime
|
||||||
|
|
||||||
|
# 配置 nginx
|
||||||
|
RUN echo "types { application/javascript js mjs; }" > /etc/nginx/conf.d/mjs.conf \
|
||||||
|
&& rm -rf /etc/nginx/conf.d/default.conf
|
||||||
|
|
||||||
|
# 复制宿主机构建产物
|
||||||
|
COPY publish/web-antd-dist /usr/share/nginx/html
|
||||||
|
|
||||||
|
# 复制 nginx 配置
|
||||||
|
COPY scripts/deploy/nginx.conf /etc/nginx/nginx.conf
|
||||||
|
|
||||||
|
EXPOSE 8080
|
||||||
|
|
||||||
|
# 启动 nginx
|
||||||
|
CMD ["nginx", "-g", "daemon off;"]
|
||||||
Reference in New Issue
Block a user