-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile
264 lines (228 loc) · 13.8 KB
/
Dockerfile
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
ARG ASPNET_VERSION=8.0
ARG BUILD_CONFIGURATION=Release
ARG NUGET_PACKAGES=/nuget/packages
FROM mcr.microsoft.com/dotnet/aspnet:${ASPNET_VERSION} AS base
ARG NUGET_PACKAGES
ENV NUGET_PACKAGES="${NUGET_PACKAGES}"
RUN apt-get update && apt-get install -y --no-install-recommends \
curl \
fontconfig \
fonts-dejavu-core \
&& fc-cache -fv \
&& rm -rf /var/lib/apt/lists/*
USER $APP_UID
WORKDIR /app
EXPOSE 8080
EXPOSE 8081
FROM mcr.microsoft.com/dotnet/sdk:${ASPNET_VERSION} AS solution-dependencies
ARG NUGET_PACKAGES
ENV NUGET_PACKAGES="${NUGET_PACKAGES}"
WORKDIR /src
COPY --link Libraries/CO.CDP.WebApi.Foundation/CO.CDP.WebApi.Foundation.csproj Libraries/CO.CDP.WebApi.Foundation/
COPY --link Libraries/CO.CDP.WebApi.Foundation.Tests/CO.CDP.WebApi.Foundation.Tests.csproj Libraries/CO.CDP.WebApi.Foundation.Tests/
COPY --link Libraries/CO.CDP.GovUKNotify/CO.CDP.GovUKNotify.csproj Libraries/CO.CDP.GovUKNotify/
COPY --link Libraries/CO.CDP.GovUKNotify.Test/CO.CDP.GovUKNotify.Test.csproj Libraries/CO.CDP.GovUKNotify.Test/
COPY --link Libraries/CO.CDP.AwsServices/CO.CDP.AwsServices.csproj Libraries/CO.CDP.AwsServices/
COPY --link Libraries/CO.CDP.AwsServices.Tests/CO.CDP.AwsServices.Tests.csproj Libraries/CO.CDP.AwsServices.Tests/
COPY --link Libraries/CO.CDP.Authentication/CO.CDP.Authentication.csproj Libraries/CO.CDP.Authentication/
COPY --link Libraries/CO.CDP.Authentication.Tests/CO.CDP.Authentication.Tests.csproj Libraries/CO.CDP.Authentication.Tests/
COPY --link Libraries/CO.CDP.Configuration/CO.CDP.Configuration.csproj Libraries/CO.CDP.Configuration/
COPY --link Libraries/CO.CDP.Configuration.Tests/CO.CDP.Configuration.Tests.csproj Libraries/CO.CDP.Configuration.Tests/
COPY --link Libraries/CO.CDP.EntityFrameworkCore/CO.CDP.EntityFrameworkCore.csproj Libraries/CO.CDP.EntityFrameworkCore/
COPY --link Libraries/CO.CDP.EntityFrameworkCore.Tests/CO.CDP.EntityFrameworkCore.Tests.csproj Libraries/CO.CDP.EntityFrameworkCore.Tests/
COPY --link Libraries/CO.CDP.Functional/CO.CDP.Functional.csproj Libraries/CO.CDP.Functional/
COPY --link Libraries/CO.CDP.Functional.Tests/CO.CDP.Functional.Tests.csproj Libraries/CO.CDP.Functional.Tests/
COPY --link Libraries/CO.CDP.MQ/CO.CDP.MQ.csproj Libraries/CO.CDP.MQ/
COPY --link Libraries/CO.CDP.MQ.Tests/CO.CDP.MQ.Tests.csproj Libraries/CO.CDP.MQ.Tests/
COPY --link Libraries/CO.CDP.Mvc.Validation/CO.CDP.Mvc.Validation.csproj Libraries/CO.CDP.Mvc.Validation/
COPY --link Libraries/CO.CDP.Mvc.Validation.Tests/CO.CDP.Mvc.Validation.Tests.csproj Libraries/CO.CDP.Mvc.Validation.Tests/
COPY --link Libraries/CO.CDP.Swashbuckle/CO.CDP.Swashbuckle.csproj Libraries/CO.CDP.Swashbuckle/
COPY --link Libraries/CO.CDP.Swashbuckle.Tests/CO.CDP.Swashbuckle.Tests.csproj Libraries/CO.CDP.Swashbuckle.Tests/
COPY --link Frontend/CO.CDP.OrganisationApp/CO.CDP.OrganisationApp.csproj Frontend/CO.CDP.OrganisationApp/
COPY --link Frontend/CO.CDP.OrganisationApp.Tests/CO.CDP.OrganisationApp.Tests.csproj Frontend/CO.CDP.OrganisationApp.Tests/
COPY --link Libraries/CO.CDP.Tenant.WebApiClient/CO.CDP.Tenant.WebApiClient.csproj Libraries/CO.CDP.Tenant.WebApiClient/
COPY --link Libraries/CO.CDP.Tenant.WebApiClient.Tests/CO.CDP.Tenant.WebApiClient.Tests.csproj Libraries/CO.CDP.Tenant.WebApiClient.Tests/
COPY --link Libraries/CO.CDP.Organisation.WebApiClient/CO.CDP.Organisation.WebApiClient.csproj Libraries/CO.CDP.Organisation.WebApiClient/
COPY --link Libraries/CO.CDP.Organisation.WebApiClient.Tests/CO.CDP.Organisation.WebApiClient.Tests.csproj Libraries/CO.CDP.Organisation.WebApiClient.Tests/
COPY --link Libraries/CO.CDP.Person.WebApiClient/CO.CDP.Person.WebApiClient.csproj Libraries/CO.CDP.Person.WebApiClient/
COPY --link Libraries/CO.CDP.Person.WebApiClient.Tests/CO.CDP.Person.WebApiClient.Tests.csproj Libraries/CO.CDP.Person.WebApiClient.Tests/
COPY --link Libraries/CO.CDP.Forms.WebApiClient/CO.CDP.Forms.WebApiClient.csproj Libraries/CO.CDP.Forms.WebApiClient/
COPY --link Libraries/CO.CDP.Forms.WebApiClient.Tests/CO.CDP.Forms.WebApiClient.Tests.csproj Libraries/CO.CDP.Forms.WebApiClient.Tests/
COPY --link Libraries/CO.CDP.DataSharing.WebApiClient/CO.CDP.DataSharing.WebApiClient.csproj Libraries/CO.CDP.DataSharing.WebApiClient/
COPY --link Libraries/CO.CDP.DataSharing.WebApiClient.Tests/CO.CDP.DataSharing.WebApiClient.Tests.csproj Libraries/CO.CDP.DataSharing.WebApiClient.Tests/
COPY --link Libraries/CO.CDP.EntityVerificationClient/CO.CDP.EntityVerificationClient.csproj Libraries/CO.CDP.EntityVerificationClient/
COPY --link TestKit/CO.CDP.TestKit.Mvc/CO.CDP.TestKit.Mvc.csproj TestKit/CO.CDP.TestKit.Mvc/
COPY --link TestKit/CO.CDP.TestKit.Mvc.Tests/CO.CDP.TestKit.Mvc.Tests.csproj TestKit/CO.CDP.TestKit.Mvc.Tests/
COPY --link TestKit/CO.CDP.Testcontainers.PostgreSql/CO.CDP.Testcontainers.PostgreSql.csproj TestKit/CO.CDP.Testcontainers.PostgreSql/
COPY --link TestKit/CO.CDP.Testcontainers.PostgreSql.Tests/CO.CDP.Testcontainers.PostgreSql.Tests.csproj TestKit/CO.CDP.Testcontainers.PostgreSql.Tests/
COPY --link Services/CO.CDP.OrganisationInformation/CO.CDP.OrganisationInformation.csproj Services/CO.CDP.OrganisationInformation/
COPY --link Services/CO.CDP.OrganisationInformation.Persistence/CO.CDP.OrganisationInformation.Persistence.csproj Services/CO.CDP.OrganisationInformation.Persistence/
COPY --link Services/CO.CDP.OrganisationInformation.Persistence.Tests/CO.CDP.OrganisationInformation.Persistence.Tests.csproj Services/CO.CDP.OrganisationInformation.Persistence.Tests/
COPY --link Services/CO.CDP.OrganisationInformation.Tests/CO.CDP.OrganisationInformation.Tests.csproj Services/CO.CDP.OrganisationInformation.Tests/
COPY --link Services/CO.CDP.Tenant.WebApi/CO.CDP.Tenant.WebApi.csproj Services/CO.CDP.Tenant.WebApi/
COPY --link Services/CO.CDP.Tenant.WebApi.Tests/CO.CDP.Tenant.WebApi.Tests.csproj Services/CO.CDP.Tenant.WebApi.Tests/
COPY --link Services/CO.CDP.DataSharing.WebApi/CO.CDP.DataSharing.WebApi.csproj Services/CO.CDP.DataSharing.WebApi/
COPY --link Services/CO.CDP.DataSharing.WebApi.Tests/CO.CDP.DataSharing.WebApi.Tests.csproj Services/CO.CDP.DataSharing.WebApi.Tests/
COPY --link Services/CO.CDP.Organisation.WebApi.Tests/CO.CDP.Organisation.WebApi.Tests.csproj Services/CO.CDP.Organisation.WebApi.Tests/
COPY --link Services/CO.CDP.Organisation.WebApi/CO.CDP.Organisation.WebApi.csproj Services/CO.CDP.Organisation.WebApi/
COPY --link Services/CO.CDP.Person.WebApi/CO.CDP.Person.WebApi.csproj Services/CO.CDP.Person.WebApi/
COPY --link Services/CO.CDP.Person.WebApi.Tests/CO.CDP.Person.WebApi.Tests.csproj Services/CO.CDP.Person.WebApi.Tests/
COPY --link Services/CO.CDP.Forms.WebApi/CO.CDP.Forms.WebApi.csproj Services/CO.CDP.Forms.WebApi/
COPY --link Services/CO.CDP.Forms.WebApi.Tests/CO.CDP.Forms.WebApi.Tests.csproj Services/CO.CDP.Forms.WebApi.Tests/
COPY --link Services/CO.CDP.Organisation.Authority/CO.CDP.Organisation.Authority.csproj Services/CO.CDP.Organisation.Authority/
COPY --link Services/CO.CDP.Organisation.Authority.Tests/CO.CDP.Organisation.Authority.Tests.csproj Services/CO.CDP.Organisation.Authority.Tests/
COPY --link Services/CO.CDP.EntityVerification/CO.CDP.EntityVerification.csproj Services/CO.CDP.EntityVerification/
COPY --link Services/CO.CDP.EntityVerification.Tests/CO.CDP.EntityVerification.Tests.csproj Services/CO.CDP.EntityVerification.Tests/
COPY --link Services/CO.CDP.Localization/CO.CDP.Localization.csproj Services/CO.CDP.Localization/
COPY --link Services/CO.CDP.AntiVirusScanner/CO.CDP.AntiVirusScanner.csproj Services/CO.CDP.AntiVirusScanner/
COPY --link Services/CO.CDP.AntiVirusScanner.Tests/CO.CDP.AntiVirusScanner.Tests.csproj Services/CO.CDP.AntiVirusScanner.Tests/
COPY --link GCGS-Central-Digital-Platform.sln .
RUN dotnet restore "GCGS-Central-Digital-Platform.sln"
FROM solution-dependencies AS source
COPY --link TestKit TestKit
COPY --link Libraries Libraries
COPY --link Services Services
COPY --link Frontend Frontend
FROM source AS build
ARG BUILD_CONFIGURATION
WORKDIR /src
RUN dotnet build -c $BUILD_CONFIGURATION
FROM build AS build-authority
ARG BUILD_CONFIGURATION
WORKDIR /src/Services/CO.CDP.Organisation.Authority
RUN dotnet build -c $BUILD_CONFIGURATION -o /app/build
FROM build AS build-tenant
ARG BUILD_CONFIGURATION
WORKDIR /src/Services/CO.CDP.Tenant.WebApi
RUN dotnet build -c $BUILD_CONFIGURATION -o /app/build
FROM build AS build-organisation
ARG BUILD_CONFIGURATION
WORKDIR /src/Services/CO.CDP.Organisation.WebApi
RUN dotnet build -c $BUILD_CONFIGURATION -o /app/build
FROM build AS build-person
ARG BUILD_CONFIGURATION
WORKDIR /src/Services/CO.CDP.Person.WebApi
RUN dotnet build -c $BUILD_CONFIGURATION -o /app/build
FROM build AS build-forms
ARG BUILD_CONFIGURATION
WORKDIR /src/Services/CO.CDP.Forms.WebApi
RUN dotnet build -c $BUILD_CONFIGURATION -o /app/build
FROM build AS build-data-sharing
ARG BUILD_CONFIGURATION
WORKDIR /src/Services/CO.CDP.DataSharing.WebApi
RUN dotnet build -c $BUILD_CONFIGURATION -o /app/build
FROM build AS build-entity-verification
ARG BUILD_CONFIGURATION
WORKDIR /src/Services/CO.CDP.EntityVerification
RUN dotnet build -c $BUILD_CONFIGURATION -o /app/build
FROM build AS build-antivirus-app
ARG BUILD_CONFIGURATION
WORKDIR /src/Services/CO.CDP.AntiVirusScanner
RUN dotnet build -c $BUILD_CONFIGURATION -o /app/build
FROM build AS build-organisation-app
ARG BUILD_CONFIGURATION
WORKDIR /src/Frontend/CO.CDP.OrganisationApp
RUN dotnet build -c $BUILD_CONFIGURATION -o /app/build
FROM build-authority AS publish-authority
ARG BUILD_CONFIGURATION
RUN dotnet publish "CO.CDP.Organisation.Authority.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false
FROM build-tenant AS publish-tenant
ARG BUILD_CONFIGURATION
RUN dotnet publish "CO.CDP.Tenant.WebApi.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false
FROM build-organisation AS publish-organisation
ARG BUILD_CONFIGURATION
RUN dotnet publish "CO.CDP.Organisation.WebApi.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false
FROM build-person AS publish-person
ARG BUILD_CONFIGURATION
RUN dotnet publish "CO.CDP.Person.WebApi.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false
FROM build-forms AS publish-forms
ARG BUILD_CONFIGURATION
RUN dotnet publish "CO.CDP.Forms.WebApi.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false
FROM build-data-sharing AS publish-data-sharing
ARG BUILD_CONFIGURATION
RUN dotnet publish "CO.CDP.DataSharing.WebApi.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false
FROM build-entity-verification AS publish-entity-verification
ARG BUILD_CONFIGURATION
RUN dotnet publish "CO.CDP.EntityVerification.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false
FROM build-organisation-app AS publish-organisation-app
ARG BUILD_CONFIGURATION
RUN dotnet publish "CO.CDP.OrganisationApp.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false
FROM build-antivirus-app AS publish-antivirus-app
ARG BUILD_CONFIGURATION
RUN dotnet publish "CO.CDP.AntiVirusScanner.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false
FROM build-tenant AS build-migrations-organisation-information
WORKDIR /src
COPY .config/dotnet-tools.json .config/
RUN dotnet tool restore
RUN dotnet ef migrations bundle -p /src/Services/CO.CDP.OrganisationInformation.Persistence -s /src/Services/CO.CDP.Tenant.WebApi --self-contained -o /app/migrations/efbundle
FROM build-entity-verification AS build-migrations-entity-verification
WORKDIR /src
COPY .config/dotnet-tools.json .config/
RUN dotnet tool restore
RUN dotnet ef migrations bundle -p /src/Services/CO.CDP.EntityVerification --self-contained -o /app/migrations/efbundle
FROM base AS migrations-organisation-information
ARG VERSION
ENV VERSION=${VERSION}
WORKDIR /app
COPY --from=build-migrations-organisation-information /app/migrations/efbundle .
ENTRYPOINT /app/efbundle --connection "Host=$OrganisationInformationDatabase__Host;Database=$OrganisationInformationDatabase__Database;Username=$OrganisationInformationDatabase__Username;Password=$OrganisationInformationDatabase__Password;"
FROM base AS migrations-entity-verification
ARG VERSION
ENV VERSION=${VERSION}
WORKDIR /app
COPY --from=build-migrations-entity-verification /app/migrations/efbundle .
ENTRYPOINT /app/efbundle --connection "Host=$EntityVerificationDatabase__Host;Database=$EntityVerificationDatabase__Database;Username=$EntityVerificationDatabase__Username;Password=$EntityVerificationDatabase__Password;"
FROM base AS final-authority
ARG VERSION
ENV VERSION=${VERSION}
WORKDIR /app
COPY --from=publish-authority /app/publish .
ENTRYPOINT ["dotnet", "CO.CDP.Organisation.Authority.dll"]
FROM base AS final-tenant
ARG VERSION
ENV VERSION=${VERSION}
WORKDIR /app
COPY --from=publish-tenant /app/publish .
ENTRYPOINT ["dotnet", "CO.CDP.Tenant.WebApi.dll"]
FROM base AS final-organisation
ARG VERSION
ENV VERSION=${VERSION}
WORKDIR /app
COPY --from=publish-organisation /app/publish .
ENTRYPOINT ["dotnet", "CO.CDP.Organisation.WebApi.dll"]
FROM base AS final-person
ARG VERSION
ENV VERSION=${VERSION}
WORKDIR /app
COPY --from=publish-person /app/publish .
ENTRYPOINT ["dotnet", "CO.CDP.Person.WebApi.dll"]
FROM base AS final-forms
ARG VERSION
ENV VERSION=${VERSION}
WORKDIR /app
COPY --from=publish-forms /app/publish .
ENTRYPOINT ["dotnet", "CO.CDP.Forms.WebApi.dll"]
FROM base AS final-data-sharing
ARG VERSION
ENV VERSION=${VERSION}
WORKDIR /app
COPY --from=publish-data-sharing /app/publish .
ENTRYPOINT ["dotnet", "CO.CDP.DataSharing.WebApi.dll"]
FROM base AS final-entity-verification
ARG VERSION
ENV VERSION=${VERSION}
WORKDIR /app
COPY --from=publish-entity-verification /app/publish .
ENTRYPOINT ["dotnet", "CO.CDP.EntityVerification.dll"]
FROM base AS final-organisation-app
ARG VERSION
ENV VERSION=${VERSION}
WORKDIR /app
COPY --from=publish-organisation-app /app/publish .
ENTRYPOINT ["dotnet", "CO.CDP.OrganisationApp.dll"]
FROM base AS final-antivirus-app
ARG VERSION
ENV VERSION=${VERSION}
WORKDIR /app
COPY --from=publish-antivirus-app /app/publish .
ENTRYPOINT ["dotnet", "CO.CDP.AntiVirusScanner.dll"]