fix(ci): 修正 Docker 构建配置和 Dockerfile 路径
Some checks failed
Build / build (push) Failing after 1m42s
Deploy to K8s / deploy (push) Failing after 2s
Build and Push Docker / build (push) Has been cancelled

- 修正 docker.yml 中 dockerfile 参数为 file 以匹配 action 版本要求
- 优化 Dockerfile,调整项目文件拷贝路径及恢复依赖步骤
- 统一工作目录路径,确保构建命令正确执行
- 删除多余的复制和恢复步骤,简化构建流程
This commit is contained in:
movingsam 2026-03-01 13:42:03 +08:00
parent 7f645ddd13
commit 18813f905a
2 changed files with 11 additions and 11 deletions

View File

@ -50,7 +50,7 @@ jobs:
uses: docker/build-push-action@v5 uses: docker/build-push-action@v5
with: with:
context: . context: .
dockerfile: src/Dockerfile file: src/Dockerfile
push: true push: true
tags: ${{ steps.meta.outputs.tags }} tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }} labels: ${{ steps.meta.outputs.labels }}

View File

@ -7,17 +7,17 @@ FROM mcr.microsoft.com/dotnet/sdk:10.0 AS build
ARG BUILD_CONFIGURATION=Release ARG BUILD_CONFIGURATION=Release
WORKDIR /src WORKDIR /src
COPY ["fengling-console/src/Fengling.Console.csproj", "fengling-console/"] # Copy Directory.Build.props and Directory.Packages.props for central package management
COPY ["fengling-gateway/src/YarpGateway.csproj", "fengling-gateway/"] COPY ["Directory.Build.props", "./"]
COPY ["fengling-platform/Fengling.Platform.Infrastructure/Fengling.Platform.Infrastructure.csproj", "fengling-platform/Fengling.Platform.Infrastructure/"] COPY ["Directory.Packages.props", "./"]
COPY ["fengling-platform/Fengling.Platform.Domain/Fengling.Platform.Domain.csproj", "fengling-platform/Fengling.Platform.Domain/"]
COPY ["fengling-service-discovery/Fengling.ServiceDiscovery.Core/Fengling.ServiceDiscovery.Core.csproj", "fengling-service-discovery/Fengling.ServiceDiscovery.Core/"]
COPY ["fengling-service-discovery/Fengling.ServiceDiscovery.Kubernetes/Fengling.ServiceDiscovery.Kubernetes.csproj", "fengling-service-discovery/Fengling.ServiceDiscovery.Kubernetes/"]
COPY ["fengling-service-discovery/Fengling.ServiceDiscovery.Static/Fengling.ServiceDiscovery.Static.csproj", "fengling-service-discovery/Fengling.ServiceDiscovery.Static/"]
RUN dotnet restore "fengling-console/Fengling.Console.csproj" # Copy project file and restore dependencies
COPY ["src/Fengling.Console.csproj", "src/"]
RUN dotnet restore "src/Fengling.Console.csproj"
# Copy source code and build
COPY . . COPY . .
WORKDIR "/src/fengling-console" WORKDIR "/src/src"
RUN dotnet build "./Fengling.Console.csproj" -c $BUILD_CONFIGURATION -o /app/build RUN dotnet build "./Fengling.Console.csproj" -c $BUILD_CONFIGURATION -o /app/build
FROM build AS publish FROM build AS publish