fix dotnet tools missing in migration bundle in cd
This commit is contained in:
@@ -1,4 +1,7 @@
|
||||
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
|
||||
# Multi-stage API image + EF migration bundle.
|
||||
# docker build -f VigilCareClinicalAPI/Dockerfile . → runtime (default)
|
||||
# docker build -f VigilCareClinicalAPI/Dockerfile --target migrate . → /out/migrate-api
|
||||
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS src
|
||||
WORKDIR /src
|
||||
|
||||
# Restore layer — copy only project files so NuGet restore is cached
|
||||
@@ -12,6 +15,8 @@ RUN dotnet restore VigilCareClinicalAPI/VigilCareClinicalAPI.csproj
|
||||
COPY VigilCare.ClinicalContracts/ VigilCare.ClinicalContracts/
|
||||
COPY VigilCare.Simulation.Core/ VigilCare.Simulation.Core/
|
||||
COPY VigilCareClinicalAPI/ VigilCareClinicalAPI/
|
||||
|
||||
FROM src AS build
|
||||
RUN dotnet publish VigilCareClinicalAPI/VigilCareClinicalAPI.csproj \
|
||||
-c Release -o /app/publish --no-restore
|
||||
|
||||
@@ -24,6 +29,21 @@ RUN sed -i \
|
||||
-e 's/"ApiKey": "dev-integration[^"]*"/"ApiKey": ""/' \
|
||||
/app/publish/appsettings.json
|
||||
|
||||
# Self-contained EF bundle for CD (docker build --target migrate).
|
||||
# Prefer docker build over docker run -v on act_runner — bind mounts resolve
|
||||
# on the Docker host, not the job workspace.
|
||||
FROM src AS migrate
|
||||
RUN dotnet tool install --global dotnet-ef --version 8.0.4 \
|
||||
&& export PATH="$PATH:/root/.dotnet/tools" \
|
||||
&& mkdir -p /out \
|
||||
&& dotnet ef migrations bundle \
|
||||
--project VigilCareClinicalAPI \
|
||||
--startup-project VigilCareClinicalAPI \
|
||||
--configuration Release \
|
||||
--self-contained -r linux-x64 \
|
||||
--output /out/migrate-api \
|
||||
--force
|
||||
|
||||
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS runtime
|
||||
WORKDIR /app
|
||||
|
||||
|
||||
Reference in New Issue
Block a user