-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdatabase-migration.Dockerfile
More file actions
35 lines (27 loc) · 1.38 KB
/
database-migration.Dockerfile
File metadata and controls
35 lines (27 loc) · 1.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# https://hub.docker.com/_/microsoft-dotnet
FROM mcr.microsoft.com/dotnet/sdk:10.0 AS build
WORKDIR /source
# create local nuget packages
COPY nuget.config ./
COPY Service.Abstractions/ ./Service.Abstractions/
COPY Service.Libraries.Redis/ ./Service.Libraries.Redis/
RUN mkdir local-nuget-feed
RUN dotnet pack -c release -o ./local-nuget-feed ./Service.Abstractions/
RUN dotnet pack -c release -o ./local-nuget-feed ./Service.Libraries.Redis/
RUN dotnet tool install --global dotnet-ef
ENV PATH="$PATH:/root/.dotnet/tools"
# copy csproj and restore as distinct layers
COPY RatingService.Domain/*.csproj ./RatingService.Domain/
COPY RatingService.Infrastructure/*.csproj ./RatingService.Infrastructure/
COPY RatingService.Infrastructure.DesignTime/*.csproj ./RatingService.Infrastructure.DesignTime/
RUN dotnet restore RatingService.Domain/
RUN dotnet restore RatingService.Infrastructure/
RUN dotnet restore RatingService.Infrastructure.DesignTime/
# copy everything else and build app?
COPY RatingService.Domain/. ./RatingService.Domain/
COPY RatingService.Infrastructure/. ./RatingService.Infrastructure/
COPY RatingService.Infrastructure.DesignTime/. ./RatingService.Infrastructure.DesignTime/
ENTRYPOINT ["dotnet", "ef", "database", "update", \
"-p", "./RatingService.Infrastructure/", \
"--startup-project", "./RatingService.Infrastructure.DesignTime/", \
"--context", "RatingContext"]