fix: use local nuget cache for faster docker build
This commit is contained in:
@@ -25,7 +25,10 @@ jobs:
|
|||||||
- name: Build Docker image
|
- name: Build Docker image
|
||||||
run: |
|
run: |
|
||||||
cd /opt/deploy/adminapi
|
cd /opt/deploy/adminapi
|
||||||
docker build -t takeoutsaas-adminapi:latest -f src/Api/TakeoutSaaS.AdminApi/Dockerfile .
|
docker buildx build \
|
||||||
|
--build-context nuget-cache=/opt/nuget-cache/packages \
|
||||||
|
-t takeoutsaas-adminapi:latest \
|
||||||
|
-f src/Api/TakeoutSaaS.AdminApi/Dockerfile .
|
||||||
|
|
||||||
- name: Deploy container
|
- name: Deploy container
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
FROM mcr.microsoft.com/dotnet/sdk:10.0 AS build
|
FROM mcr.microsoft.com/dotnet/sdk:10.0 AS build
|
||||||
WORKDIR /src
|
WORKDIR /src
|
||||||
|
|
||||||
|
# 复制预先准备好的 NuGet 包缓存
|
||||||
|
COPY --from=nuget-cache / /root/.nuget/packages/
|
||||||
|
|
||||||
# Copy only what's needed for restore first, so `dotnet restore` can be cached.
|
# Copy only what's needed for restore first, so `dotnet restore` can be cached.
|
||||||
COPY ["Directory.Build.props", "./"]
|
COPY ["Directory.Build.props", "./"]
|
||||||
COPY ["TakeoutSaaS.sln", "./"]
|
COPY ["TakeoutSaaS.sln", "./"]
|
||||||
|
|||||||
Reference in New Issue
Block a user