mirror of
https://github.com/142vip/408CSFamily.git
synced 2026-04-14 02:09:56 +08:00
fix(GitHub Actions): 修复CI流水线docker构建异常 (#110)
* fix(GitHub Actions): 修复`CI`流水线`docker`构建异常 * chore: update * chore: update * chore: update --------- Co-authored-by: chufan <mmdapl@163.com>
This commit is contained in:
33
.github/workflows/CI.yml
vendored
33
.github/workflows/CI.yml
vendored
@@ -27,7 +27,7 @@ jobs:
|
||||
Base-Build:
|
||||
name: 基础编译构建
|
||||
runs-on: ubuntu-latest
|
||||
# # 主库且拉取PR时触发
|
||||
# 主库且拉取PR时触发
|
||||
if: github.repository == '142vip/408CSFamily' && github.event_name == 'pull_request'
|
||||
permissions:
|
||||
actions: read
|
||||
@@ -47,7 +47,7 @@ jobs:
|
||||
with:
|
||||
version: 9.6.0
|
||||
|
||||
# # 安装Node环境
|
||||
# 安装Node环境
|
||||
- name: Install Node.js
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
@@ -55,7 +55,7 @@ jobs:
|
||||
# # 缓存
|
||||
cache: pnpm
|
||||
|
||||
# # 下载依赖,并执行初始化脚本:钩子函数、思维导图构建
|
||||
# 下载依赖,并执行初始化脚本:钩子函数、思维导图构建
|
||||
- name: Install Dependencies
|
||||
run: |
|
||||
./scripts/ci
|
||||
@@ -75,7 +75,7 @@ jobs:
|
||||
Build-Docker-Image:
|
||||
name: 构建Docker镜像
|
||||
runs-on: ubuntu-latest
|
||||
# # 主库且tag更新时执行
|
||||
# 主库且tag更新时执行
|
||||
if: github.repository == '142vip/408CSFamily' && startsWith(github.event.head_commit.message, 'chore(release):')
|
||||
permissions:
|
||||
actions: read
|
||||
@@ -104,16 +104,31 @@ jobs:
|
||||
--password=${{ secrets.DOCKER_PASSWORD }} \
|
||||
${{env.REGISTRY}}
|
||||
|
||||
# 安装PNPM
|
||||
- name: PNPM Install
|
||||
uses: pnpm/action-setup@v4
|
||||
with:
|
||||
version: 9.6.0
|
||||
|
||||
# 安装Node环境
|
||||
- name: Install Node.js
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 20.16.0
|
||||
# # 缓存
|
||||
cache: pnpm
|
||||
|
||||
# 下载依赖,并执行初始化脚本:钩子函数、思维导图构建
|
||||
- name: Install Dependencies
|
||||
run: |
|
||||
./scripts/ci
|
||||
|
||||
# # 构建,支持domain
|
||||
- name: Build To Dist
|
||||
run: |
|
||||
pnpm build
|
||||
# # 构建,支持domain
|
||||
# - name: Build To Dist
|
||||
# run: |
|
||||
# pnpm build
|
||||
|
||||
# # 快速构建并推送
|
||||
# 快速构建并推送
|
||||
- name: Push Docker Image
|
||||
run: |
|
||||
./scripts/bundle
|
||||
|
||||
11
Dockerfile
11
Dockerfile
@@ -1,6 +1,6 @@
|
||||
#
|
||||
# - 功能: 408CSFamily镜像构建
|
||||
# - 用法: docker build -f Dockerfile --build-arg APP_VERSION=0.0.1 --build-arg CONTAINER_BUILD=true -t 408CSFamily-0.0.1 .
|
||||
# - 用法: docker build -f Dockerfile --build-arg APP_VERSION=0.0.1 -t 408CSFamily-0.0.1 .
|
||||
# - 参数:
|
||||
# APP_VERSION: 版本
|
||||
# CONTAINER_BUILD: 采用容器构建
|
||||
@@ -20,11 +20,14 @@ COPY . .
|
||||
RUN echo $CONTAINER_BUILD;
|
||||
|
||||
## 基于容器自动构建
|
||||
RUN --mount=type=cache,id=pnpm,target=/pnpm/store if [ "$CONTAINER_BUILD" = "true" ]; then \
|
||||
sh ./scripts/ci && pnpm build; \
|
||||
RUN --mount=type=cache,id=pnpm,target=/pnpm/store sh ./scripts/ci && if [ "$NEED_PROXY" = "false" ]; \
|
||||
then \
|
||||
pnpm build; \
|
||||
else \
|
||||
pnpm build:proxy; \
|
||||
fi;
|
||||
|
||||
FROM registry.cn-hangzhou.aliyuncs.com/142vip/nginx:1.23.0-alpine
|
||||
FROM registry.cn-hangzhou.aliyuncs.com/142vip/nginx:1.27.0-alpine
|
||||
|
||||
ARG APP_NAME
|
||||
ARG APP_VERSION
|
||||
|
||||
Reference in New Issue
Block a user