Skip to content

Commit 7897b81

Browse files
Docker files updated to copy dependencies of SDKs and contracts projects.
1 parent c42eed9 commit 7897b81

File tree

3 files changed

+48
-8
lines changed

3 files changed

+48
-8
lines changed

ApiIntegrationMvc/Dockerfile

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# ------------ Build stage ------------
2+
FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build
3+
WORKDIR /src
4+
5+
# Copy ApiIntegrationMvc + the SDKs it depends on
6+
COPY UserManagement.Contracts/UserManagement.Contracts.csproj UserManagement.Contracts/
7+
COPY CentralizedLogging.Contracts/CentralizedLogging.Contracts.csproj CentralizedLogging.Contracts/
8+
COPY UserManagement.Sdk/UserManagement.Sdk.csproj UserManagement.Sdk/
9+
COPY CentralizedLogging.Sdk/CentralizedLogging.Sdk.csproj CentralizedLogging.Sdk/
10+
COPY ApiIntegrationMvc/ApiIntegrationMvc.csproj ApiIntegrationMvc/
11+
12+
RUN dotnet restore ApiIntegrationMvc/ApiIntegrationMvc.csproj
13+
14+
COPY . .
15+
RUN dotnet publish ApiIntegrationMvc/ApiIntegrationMvc.csproj -c Release -o /app
16+
17+
# ------------ Runtime stage ------------
18+
FROM mcr.microsoft.com/dotnet/aspnet:9.0
19+
WORKDIR /app
20+
21+
# Install required libraries for Microsoft.Data.SqlClient on Linux
22+
RUN apt-get update && apt-get install -y \
23+
libkrb5-3 \
24+
libgssapi-krb5-2 \
25+
&& rm -rf /var/lib/apt/lists/*
26+
27+
# Copy published output
28+
COPY --from=build /app ./
29+
30+
EXPOSE 8080
31+
EXPOSE 8081
32+
33+
# Replace with the actual assembly name if different
34+
ENTRYPOINT ["dotnet", "ApiIntegrationMvc.dll"]

CentralizedLoggingApi/Dockerfile

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,14 @@
22
FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build
33
WORKDIR /src
44

5-
COPY *.csproj ./
6-
RUN dotnet restore
5+
# Copy CentralizedLoggingApi + the SDKs it depends on
6+
COPY CentralizedLogging.Contracts/CentralizedLogging.Contracts.csproj CentralizedLogging.Contracts/
7+
COPY CentralizedLoggingApi/CentralizedLoggingApi.csproj CentralizedLoggingApi/
78

8-
COPY . ./
9-
RUN dotnet publish -c Release -o /app
9+
RUN dotnet restore CentralizedLoggingApi/CentralizedLoggingApi.csproj
10+
11+
COPY . .
12+
RUN dotnet publish CentralizedLoggingApi/CentralizedLoggingApi.csproj -c Release -o /app
1013

1114
# Runtime stage
1215
FROM mcr.microsoft.com/dotnet/aspnet:9.0

UserManagementApi/Dockerfile

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,14 @@
22
FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build
33
WORKDIR /src
44

5-
COPY *.csproj ./
6-
RUN dotnet restore
5+
# Copy UserManagementApi + the SDKs it depends on
6+
COPY UserManagement.Contracts/UserManagement.Contracts.csproj UserManagement.Contracts/
7+
COPY UserManagementApi/UserManagementApi.csproj UserManagementApi/
78

8-
COPY . ./
9-
RUN dotnet publish -c Release -o /app
9+
RUN dotnet restore UserManagementApi/UserManagementApi.csproj
10+
11+
COPY . .
12+
RUN dotnet publish UserManagementApi/UserManagementApi.csproj -c Release -o /app
1013

1114
# Runtime stage
1215
FROM mcr.microsoft.com/dotnet/aspnet:9.0

0 commit comments

Comments
 (0)