preset dotnet 重命名为 dotnet10
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
|
||||
- `context`:指定构建目录(前端/后端在子目录时用)
|
||||
- `dockerfile`:指定 Dockerfile 的完整路径
|
||||
- `preset`:内置方案,对应 action 根目录下的 `vue3.Dockerfile`、`vue3-hash.Dockerfile`、`dotnet.Dockerfile`
|
||||
- `preset`:内置方案,对应 action 根目录下的 `vue3.Dockerfile`、`vue3-hash.Dockerfile`、`dotnet10.Dockerfile`
|
||||
|
||||
优先级:**`dockerfile` > `preset` > `context` 下的默认 `Dockerfile`**。
|
||||
设置了 `dockerfile` 时完全忽略 `preset`;设置了 `preset` 时用对应的 Dockerfile 构建,构建完自动 push 到 registry。
|
||||
@@ -15,11 +15,11 @@
|
||||
| --- | --- | --- |
|
||||
| `vue3` | `vue3.Dockerfile` | Vue3 + history 路由,nginx 做 `try_files` 回退并带跨域头 |
|
||||
| `vue3-hash` | `vue3-hash.Dockerfile` | Vue3 + hash 路由,nginx 默认配置 |
|
||||
| `dotnet` | `dotnet.Dockerfile` | .NET self-contained 发布(linux-x64) |
|
||||
| `dotnet10` | `dotnet10.Dockerfile` | .NET 10 self-contained 发布(linux-x64) |
|
||||
|
||||
- 编译全部写在 Dockerfile 里(多阶段构建),action 本身只负责传 `--build-arg VERSION=<tag>`:
|
||||
- vue:`npm ci` → `npm run build-only`(没有该脚本时回退 `npm run build`)→ `npm pkg set version=<tag>`
|
||||
- dotnet:`dotnet publish -r linux-x64 -c Release --self-contained -p:AssemblyName=App -p:Version=<tag>`
|
||||
- dotnet10:`dotnet publish -r linux-x64 -c Release --self-contained -p:AssemblyName=App -p:Version=<tag>`
|
||||
- `vue3` 的 nginx 配置也内联在 Dockerfile 里:`context` 下有 `nginx.conf` 就用项目的,否则用内置默认配置(history 回退 + 跨域头)。
|
||||
|
||||
## 参数
|
||||
@@ -34,7 +34,7 @@
|
||||
| `platform` | 否 | `linux/amd64` | 构建平台 |
|
||||
| `context` | 否 | `.` | 构建目录,相对仓库根目录 |
|
||||
| `dockerfile` | 否 | 空 | Dockerfile 完整路径(相对仓库根目录或绝对路径) |
|
||||
| `preset` | 否 | 空 | 内置方案:`vue3` / `vue3-hash` / `dotnet` |
|
||||
| `preset` | 否 | 空 | 内置方案:`vue3` / `vue3-hash` / `dotnet10` |
|
||||
|
||||
## 示例
|
||||
|
||||
@@ -58,7 +58,7 @@
|
||||
- uses: actions/magic-docker@main
|
||||
with:
|
||||
context: backend
|
||||
preset: dotnet
|
||||
preset: dotnet10
|
||||
```
|
||||
|
||||
### 使用自己的 Dockerfile
|
||||
|
||||
+3
-3
@@ -1,6 +1,6 @@
|
||||
# action.yml
|
||||
name: "magic docker build and push"
|
||||
description: "一键构建并推送 Docker 镜像:支持自定义 context / dockerfile,或使用内置 preset(vue3、vue3-hash、dotnet)"
|
||||
description: "一键构建并推送 Docker 镜像:支持自定义 context / dockerfile,或使用内置 preset(vue3、vue3-hash、dotnet10)"
|
||||
|
||||
inputs:
|
||||
registry:
|
||||
@@ -36,7 +36,7 @@ inputs:
|
||||
required: false
|
||||
default: ""
|
||||
preset:
|
||||
description: "内置方案:vue3 / vue3-hash / dotnet。未设置 dockerfile 时生效(默认留空)"
|
||||
description: "内置方案:vue3 / vue3-hash / dotnet10。未设置 dockerfile 时生效(默认留空)"
|
||||
required: false
|
||||
default: ""
|
||||
|
||||
@@ -76,7 +76,7 @@ runs:
|
||||
elif [ -n "$preset" ]; then
|
||||
dockerfile_path="$ACTION_PATH/$preset.Dockerfile"
|
||||
if [ ! -f "$dockerfile_path" ]; then
|
||||
echo "未知 preset:$preset(可选:vue3 / vue3-hash / dotnet)"
|
||||
echo "未知 preset:$preset(可选:vue3 / vue3-hash / dotnet10)"
|
||||
exit 1
|
||||
fi
|
||||
# preset 的 Dockerfile 用 VERSION 覆盖 package.json 版本 / dotnet Version
|
||||
|
||||
Reference in New Issue
Block a user