27 lines
876 B
Docker
27 lines
876 B
Docker
|
|
# Migrations runner
|
||
|
|
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
|
||
|
|
WORKDIR /src
|
||
|
|
|
||
|
|
# Install EF Core tools
|
||
|
|
RUN dotnet tool install --global dotnet-ef
|
||
|
|
ENV PATH="$PATH:/root/.dotnet/tools"
|
||
|
|
|
||
|
|
# Copy solution and project files
|
||
|
|
COPY TrueCV.sln ./
|
||
|
|
COPY src/TrueCV.Domain/TrueCV.Domain.csproj src/TrueCV.Domain/
|
||
|
|
COPY src/TrueCV.Application/TrueCV.Application.csproj src/TrueCV.Application/
|
||
|
|
COPY src/TrueCV.Infrastructure/TrueCV.Infrastructure.csproj src/TrueCV.Infrastructure/
|
||
|
|
COPY src/TrueCV.Web/TrueCV.Web.csproj src/TrueCV.Web/
|
||
|
|
|
||
|
|
# Restore dependencies
|
||
|
|
RUN dotnet restore
|
||
|
|
|
||
|
|
# Copy all source code
|
||
|
|
COPY src/ src/
|
||
|
|
|
||
|
|
# Build the project
|
||
|
|
RUN dotnet build src/TrueCV.Web/TrueCV.Web.csproj -c Release
|
||
|
|
|
||
|
|
# Run migrations on startup
|
||
|
|
ENTRYPOINT ["dotnet", "ef", "database", "update", "--project", "src/TrueCV.Infrastructure", "--startup-project", "src/TrueCV.Web", "--no-build", "-c", "Release"]
|