-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.migrations
More file actions
56 lines (46 loc) · 2.36 KB
/
Dockerfile.migrations
File metadata and controls
56 lines (46 loc) · 2.36 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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# Multi-stage Dockerfile for Fluent Migrator runners
# Usage: docker build --build-arg SERVICE_NAME=Contracts -f Dockerfile.migrations .
ARG SERVICE_NAME
# Stage 1: Restore dependencies
FROM mcr.microsoft.com/dotnet/sdk:10.0 AS restore
ARG SERVICE_NAME
WORKDIR /src
# Trust corporate proxy root certificate
COPY docker/certs/RootCert.pem /usr/local/share/ca-certificates/RootCert.crt
RUN update-ca-certificates
# Copy solution and central build files
COPY src/MidstreamHub.sln .
COPY src/Directory.Build.props .
COPY src/Directory.Packages.props .
COPY src/StyleCopAnalyzers.ruleset .
COPY src/stylecop.json .
COPY src/nuget.config .
COPY local-nuget/ /local-nuget/
# Copy shared project files
COPY src/Shared/MidstreamHub.Contracts.Messages/MidstreamHub.Contracts.Messages.csproj \
Shared/MidstreamHub.Contracts.Messages/
COPY src/Shared/MidstreamHub.Domain.Common/MidstreamHub.Domain.Common.csproj \
Shared/MidstreamHub.Domain.Common/
COPY src/Shared/MidstreamHub.Infrastructure.Common/MidstreamHub.Infrastructure.Common.csproj \
Shared/MidstreamHub.Infrastructure.Common/
# Copy migration project files
COPY src/${SERVICE_NAME}/MidstreamHub.${SERVICE_NAME}.Migrations/MidstreamHub.${SERVICE_NAME}.Migrations.csproj \
${SERVICE_NAME}/MidstreamHub.${SERVICE_NAME}.Migrations/
COPY src/${SERVICE_NAME}/MidstreamHub.${SERVICE_NAME}.Migrations.Runner/MidstreamHub.${SERVICE_NAME}.Migrations.Runner.csproj \
${SERVICE_NAME}/MidstreamHub.${SERVICE_NAME}.Migrations.Runner/
RUN dotnet restore ${SERVICE_NAME}/MidstreamHub.${SERVICE_NAME}.Migrations.Runner/MidstreamHub.${SERVICE_NAME}.Migrations.Runner.csproj
# Stage 2: Build and publish
FROM restore AS build
ARG SERVICE_NAME
COPY src/Shared/ Shared/
COPY src/${SERVICE_NAME}/MidstreamHub.${SERVICE_NAME}.Migrations/ ${SERVICE_NAME}/MidstreamHub.${SERVICE_NAME}.Migrations/
COPY src/${SERVICE_NAME}/MidstreamHub.${SERVICE_NAME}.Migrations.Runner/ ${SERVICE_NAME}/MidstreamHub.${SERVICE_NAME}.Migrations.Runner/
RUN dotnet publish ${SERVICE_NAME}/MidstreamHub.${SERVICE_NAME}.Migrations.Runner/MidstreamHub.${SERVICE_NAME}.Migrations.Runner.csproj \
-c Release -o /app/publish
# Stage 3: Runtime
FROM mcr.microsoft.com/dotnet/aspnet:10.0 AS runtime
WORKDIR /app
COPY --from=build /app/publish .
ENTRYPOINT ["dotnet"]
CMD ["placeholder.dll"]
# CMD is overridden by K8S manifest to: MidstreamHub.${SERVICE_NAME}.Migrations.Runner.dll