Skip to content
This repository was archived by the owner on Apr 11, 2024. It is now read-only.

Commit 0f0dddb

Browse files
committed
feat: separate dockerfile for each services
This will let each service use different sdk version and language if needed
1 parent 0b461a2 commit 0f0dddb

5 files changed

Lines changed: 50 additions & 136 deletions

File tree

src/ApiGateways/eSchool.GraphQL/Dockerfile

Lines changed: 10 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,23 @@
1-
FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base
1+
#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.
2+
3+
FROM mcr.microsoft.com/dotnet/aspnet:5.0 AS base
24
WORKDIR /app
35
EXPOSE 80
46

5-
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
7+
FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build
68
WORKDIR /src
79

8-
COPY "eSchool.sln" "eSchool.sln"
9-
10-
COPY "src/ApiGateways/eSchool.GraphQL/eSchool.GraphQL.csproj" "src/ApiGateways/eSchool.GraphQL/eSchool.GraphQL.csproj"
11-
12-
COPY "src/Services/Enrolling/Enrolling.API/Enrolling.API.csproj" "src/Services/Enrolling/Enrolling.API/Enrolling.API.csproj"
13-
COPY "src/Services/Enrolling/Enrolling.Domain/Enrolling.Domain.csproj" "src/Services/Enrolling/Enrolling.Domain/Enrolling.Domain.csproj"
14-
COPY "src/Services/Enrolling/Enrolling.Infrastructure/Enrolling.Infrastructure.csproj" "src/Services/Enrolling/Enrolling.Infrastructure/Enrolling.Infrastructure.csproj"
15-
COPY "src/Services/Enrolling/Enrolling.UnitTests/Enrolling.UnitTests.csproj" "src/Services/Enrolling/Enrolling.UnitTests/Enrolling.UnitTests.csproj"
16-
COPY "src/Services/Enrolling/Enrolling.FunctionalTests/Enrolling.FunctionalTests.csproj" "src/Services/Enrolling/Enrolling.FunctionalTests/Enrolling.FunctionalTests.csproj"
17-
18-
COPY "src/Services/CertificateProcessing/CertificateProcessing.API/CertificateProcessing.API.csproj" "src/Services/CertificateProcessing/CertificateProcessing.API/CertificateProcessing.API.csproj"
19-
20-
COPY "src/Libraries/OpenTelemetry/OpenTelemetry.csproj" "src/Libraries/OpenTelemetry/OpenTelemetry.csproj"
10+
COPY ["src/ApiGateways/eSchool.GraphQL/eSchool.GraphQL.csproj", "src/ApiGateways/eSchool.GraphQL/"]
11+
COPY ["src/Libraries/OpenTelemetry/OpenTelemetry.csproj", "src/Libraries/OpenTelemetry/"]
2112

22-
COPY "src/Web/WebStatus/WebStatus.csproj" "src/Web/WebStatus/WebStatus.csproj"
23-
24-
COPY "src/Web/Frontend.Blazor/Frontend.Blazor.Server/Frontend.Blazor.Server.csproj" "src/Web/Frontend.Blazor/Frontend.Blazor.Server/Frontend.Blazor.Server.csproj"
25-
COPY "src/Web/Frontend.Blazor/Frontend.Blazor.Client/Frontend.Blazor.Client.csproj" "src/Web/Frontend.Blazor/Frontend.Blazor.Client/Frontend.Blazor.Client.csproj"
26-
COPY "src/Web/Frontend.Blazor/Frontend.Blazor.Shared/Frontend.Blazor.Shared.csproj" "src/Web/Frontend.Blazor/Frontend.Blazor.Shared/Frontend.Blazor.Shared.csproj"
27-
28-
COPY "docker-compose.dcproj" "docker-compose.dcproj"
29-
30-
RUN dotnet restore eSchool.sln -nowarn:msb3202,nu1503
13+
RUN dotnet restore "src/ApiGateways/eSchool.GraphQL/eSchool.GraphQL.csproj"
3114

3215
COPY . .
33-
WORKDIR /src/src/ApiGateways/eSchool.GraphQL
34-
RUN dotnet build --no-restore -c Release -o /app/build
35-
36-
FROM build as unittest
37-
WORKDIR /src/src/Services/Enrolling/Enrolling.UnitTests
16+
WORKDIR "/src/src/ApiGateways/eSchool.GraphQL"
17+
RUN dotnet build "eSchool.GraphQL.csproj" -c Release -o /app/build
3818

3919
FROM build AS publish
40-
RUN dotnet publish --no-restore -c Release -o /app/publish
20+
RUN dotnet publish "eSchool.GraphQL.csproj" -c Release -o /app/publish
4121

4222
FROM base AS final
4323
WORKDIR /app

src/Services/CertificateProcessing/CertificateProcessing.API/Dockerfile

Lines changed: 9 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,22 @@
1-
FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base
1+
#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.
2+
3+
FROM mcr.microsoft.com/dotnet/aspnet:5.0 AS base
24
WORKDIR /app
35
EXPOSE 80
46

5-
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
7+
FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build
68
WORKDIR /src
79

8-
COPY "eSchool.sln" "eSchool.sln"
9-
10-
COPY "src/ApiGateways/eSchool.GraphQL/eSchool.GraphQL.csproj" "src/ApiGateways/eSchool.GraphQL/eSchool.GraphQL.csproj"
11-
12-
COPY "src/Services/Enrolling/Enrolling.API/Enrolling.API.csproj" "src/Services/Enrolling/Enrolling.API/Enrolling.API.csproj"
13-
COPY "src/Services/Enrolling/Enrolling.Domain/Enrolling.Domain.csproj" "src/Services/Enrolling/Enrolling.Domain/Enrolling.Domain.csproj"
14-
COPY "src/Services/Enrolling/Enrolling.Infrastructure/Enrolling.Infrastructure.csproj" "src/Services/Enrolling/Enrolling.Infrastructure/Enrolling.Infrastructure.csproj"
15-
COPY "src/Services/Enrolling/Enrolling.UnitTests/Enrolling.UnitTests.csproj" "src/Services/Enrolling/Enrolling.UnitTests/Enrolling.UnitTests.csproj"
16-
COPY "src/Services/Enrolling/Enrolling.FunctionalTests/Enrolling.FunctionalTests.csproj" "src/Services/Enrolling/Enrolling.FunctionalTests/Enrolling.FunctionalTests.csproj"
17-
18-
COPY "src/Services/CertificateProcessing/CertificateProcessing.API/CertificateProcessing.API.csproj" "src/Services/CertificateProcessing/CertificateProcessing.API/CertificateProcessing.API.csproj"
19-
20-
COPY "src/Libraries/OpenTelemetry/OpenTelemetry.csproj" "src/Libraries/OpenTelemetry/OpenTelemetry.csproj"
21-
22-
COPY "src/Web/WebStatus/WebStatus.csproj" "src/Web/WebStatus/WebStatus.csproj"
23-
24-
COPY "src/Web/Frontend.Blazor/Frontend.Blazor.Server/Frontend.Blazor.Server.csproj" "src/Web/Frontend.Blazor/Frontend.Blazor.Server/Frontend.Blazor.Server.csproj"
25-
COPY "src/Web/Frontend.Blazor/Frontend.Blazor.Client/Frontend.Blazor.Client.csproj" "src/Web/Frontend.Blazor/Frontend.Blazor.Client/Frontend.Blazor.Client.csproj"
26-
COPY "src/Web/Frontend.Blazor/Frontend.Blazor.Shared/Frontend.Blazor.Shared.csproj" "src/Web/Frontend.Blazor/Frontend.Blazor.Shared/Frontend.Blazor.Shared.csproj"
27-
28-
COPY "docker-compose.dcproj" "docker-compose.dcproj"
10+
COPY ["src/Services/CertificateProcessing/CertificateProcessing.API/CertificateProcessing.API.csproj", "src/Services/CertificateProcessing/CertificateProcessing.API/"]
2911

30-
RUN dotnet restore eSchool.sln -nowarn:msb3202,nu1503
12+
RUN dotnet restore "src/Services/CertificateProcessing/CertificateProcessing.API/CertificateProcessing.API.csproj"
3113

3214
COPY . .
33-
WORKDIR /src/src/Services/CertificateProcessing/CertificateProcessing.API
34-
RUN dotnet build --no-restore -c Release -o /app/build
15+
WORKDIR "/src/src/Services/CertificateProcessing/CertificateProcessing.API"
16+
RUN dotnet build "CertificateProcessing.API.csproj" -c Release -o /app/build
3517

3618
FROM build AS publish
37-
RUN dotnet publish --no-restore -c Release -o /app/publish
19+
RUN dotnet publish "CertificateProcessing.API.csproj" -c Release -o /app/publish
3820

3921
FROM base AS final
4022
WORKDIR /app

src/Services/Enrolling/Enrolling.API/Dockerfile

Lines changed: 10 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,23 @@
1+
#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.
2+
13
FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base
24
WORKDIR /app
35
EXPOSE 80
46

57
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
68
WORKDIR /src
79

8-
COPY "eSchool.sln" "eSchool.sln"
9-
10-
COPY "src/ApiGateways/eSchool.GraphQL/eSchool.GraphQL.csproj" "src/ApiGateways/eSchool.GraphQL/eSchool.GraphQL.csproj"
11-
12-
COPY "src/Services/Enrolling/Enrolling.API/Enrolling.API.csproj" "src/Services/Enrolling/Enrolling.API/Enrolling.API.csproj"
13-
COPY "src/Services/Enrolling/Enrolling.Domain/Enrolling.Domain.csproj" "src/Services/Enrolling/Enrolling.Domain/Enrolling.Domain.csproj"
14-
COPY "src/Services/Enrolling/Enrolling.Infrastructure/Enrolling.Infrastructure.csproj" "src/Services/Enrolling/Enrolling.Infrastructure/Enrolling.Infrastructure.csproj"
15-
COPY "src/Services/Enrolling/Enrolling.UnitTests/Enrolling.UnitTests.csproj" "src/Services/Enrolling/Enrolling.UnitTests/Enrolling.UnitTests.csproj"
16-
COPY "src/Services/Enrolling/Enrolling.FunctionalTests/Enrolling.FunctionalTests.csproj" "src/Services/Enrolling/Enrolling.FunctionalTests/Enrolling.FunctionalTests.csproj"
17-
18-
COPY "src/Services/CertificateProcessing/CertificateProcessing.API/CertificateProcessing.API.csproj" "src/Services/CertificateProcessing/CertificateProcessing.API/CertificateProcessing.API.csproj"
19-
20-
COPY "src/Libraries/OpenTelemetry/OpenTelemetry.csproj" "src/Libraries/OpenTelemetry/OpenTelemetry.csproj"
21-
22-
COPY "src/Web/WebStatus/WebStatus.csproj" "src/Web/WebStatus/WebStatus.csproj"
23-
24-
COPY "src/Web/Frontend.Blazor/Frontend.Blazor.Server/Frontend.Blazor.Server.csproj" "src/Web/Frontend.Blazor/Frontend.Blazor.Server/Frontend.Blazor.Server.csproj"
25-
COPY "src/Web/Frontend.Blazor/Frontend.Blazor.Client/Frontend.Blazor.Client.csproj" "src/Web/Frontend.Blazor/Frontend.Blazor.Client/Frontend.Blazor.Client.csproj"
26-
COPY "src/Web/Frontend.Blazor/Frontend.Blazor.Shared/Frontend.Blazor.Shared.csproj" "src/Web/Frontend.Blazor/Frontend.Blazor.Shared/Frontend.Blazor.Shared.csproj"
10+
COPY ["src/Services/Enrolling/Enrolling.API/Enrolling.API.csproj", "src/Services/Enrolling/Enrolling.API/"]
11+
COPY ["src/Services/Enrolling/Enrolling.Infrastructure/Enrolling.Infrastructure.csproj", "src/Services/Enrolling/Enrolling.Infrastructure/"]
12+
COPY ["src/Services/Enrolling/Enrolling.Domain/Enrolling.Domain.csproj", "src/Services/Enrolling/Enrolling.Domain/"]
2713

28-
COPY "docker-compose.dcproj" "docker-compose.dcproj"
14+
COPY ["src/Libraries/OpenTelemetry/OpenTelemetry.csproj", "src/Libraries/OpenTelemetry/"]
2915

30-
RUN dotnet restore eSchool.sln -nowarn:msb3202,nu1503
16+
RUN dotnet restore "src/Services/Enrolling/Enrolling.API/Enrolling.API.csproj"
3117

3218
COPY . .
33-
WORKDIR /src/src/Services/Enrolling/Enrolling.API
34-
RUN dotnet build --no-restore -c Release -o /app/build
19+
WORKDIR "/src/src/Services/Enrolling/Enrolling.API"
20+
RUN dotnet build "Enrolling.API.csproj" -c Release -o /app/build
3521

3622
FROM build as unittest
3723
WORKDIR /src/src/Services/Enrolling/Enrolling.UnitTests
@@ -40,7 +26,7 @@ FROM build as functionaltest
4026
WORKDIR /src/src/Services/Enrolling/Enrolling.FunctionalTests
4127

4228
FROM build AS publish
43-
RUN dotnet publish --no-restore -c Release -o /app/publish
29+
RUN dotnet publish "Enrolling.API.csproj" -c Release -o /app/publish
4430

4531
FROM base AS final
4632
WORKDIR /app

src/Web/Frontend.Blazor/Frontend.Blazor.Server/Dockerfile

Lines changed: 11 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,24 @@
1-
FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base
1+
#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.
2+
3+
FROM mcr.microsoft.com/dotnet/aspnet:5.0 AS base
24
WORKDIR /app
35
EXPOSE 80
46

5-
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
7+
FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build
68
WORKDIR /src
79

8-
COPY "eSchool.sln" "eSchool.sln"
9-
10-
COPY "src/ApiGateways/eSchool.GraphQL/eSchool.GraphQL.csproj" "src/ApiGateways/eSchool.GraphQL/eSchool.GraphQL.csproj"
11-
12-
COPY "src/Services/Enrolling/Enrolling.API/Enrolling.API.csproj" "src/Services/Enrolling/Enrolling.API/Enrolling.API.csproj"
13-
COPY "src/Services/Enrolling/Enrolling.Domain/Enrolling.Domain.csproj" "src/Services/Enrolling/Enrolling.Domain/Enrolling.Domain.csproj"
14-
COPY "src/Services/Enrolling/Enrolling.Infrastructure/Enrolling.Infrastructure.csproj" "src/Services/Enrolling/Enrolling.Infrastructure/Enrolling.Infrastructure.csproj"
15-
COPY "src/Services/Enrolling/Enrolling.UnitTests/Enrolling.UnitTests.csproj" "src/Services/Enrolling/Enrolling.UnitTests/Enrolling.UnitTests.csproj"
16-
COPY "src/Services/Enrolling/Enrolling.FunctionalTests/Enrolling.FunctionalTests.csproj" "src/Services/Enrolling/Enrolling.FunctionalTests/Enrolling.FunctionalTests.csproj"
17-
18-
COPY "src/Services/CertificateProcessing/CertificateProcessing.API/CertificateProcessing.API.csproj" "src/Services/CertificateProcessing/CertificateProcessing.API/CertificateProcessing.API.csproj"
19-
20-
COPY "src/Libraries/OpenTelemetry/OpenTelemetry.csproj" "src/Libraries/OpenTelemetry/OpenTelemetry.csproj"
21-
22-
COPY "src/Web/WebStatus/WebStatus.csproj" "src/Web/WebStatus/WebStatus.csproj"
23-
24-
COPY "src/Web/Frontend.Blazor/Frontend.Blazor.Server/Frontend.Blazor.Server.csproj" "src/Web/Frontend.Blazor/Frontend.Blazor.Server/Frontend.Blazor.Server.csproj"
25-
COPY "src/Web/Frontend.Blazor/Frontend.Blazor.Client/Frontend.Blazor.Client.csproj" "src/Web/Frontend.Blazor/Frontend.Blazor.Client/Frontend.Blazor.Client.csproj"
26-
COPY "src/Web/Frontend.Blazor/Frontend.Blazor.Shared/Frontend.Blazor.Shared.csproj" "src/Web/Frontend.Blazor/Frontend.Blazor.Shared/Frontend.Blazor.Shared.csproj"
27-
28-
COPY "docker-compose.dcproj" "docker-compose.dcproj"
10+
COPY ["src/Web/Frontend.Blazor/Frontend.Blazor.Server/Frontend.Blazor.Server.csproj", "src/Web/Frontend.Blazor/Frontend.Blazor.Server/"]
11+
COPY ["src/Web/Frontend.Blazor/Frontend.Blazor.Shared/Frontend.Blazor.Shared.csproj", "src/Web/Frontend.Blazor/Frontend.Blazor.Shared/"]
12+
COPY ["src/Web/Frontend.Blazor/Frontend.Blazor.Client/Frontend.Blazor.Client.csproj", "src/Web/Frontend.Blazor/Frontend.Blazor.Client/"]
2913

30-
RUN dotnet restore eSchool.sln -nowarn:msb3202,nu1503
14+
RUN dotnet restore "src/Web/Frontend.Blazor/Frontend.Blazor.Server/Frontend.Blazor.Server.csproj"
3115

3216
COPY . .
33-
WORKDIR /src/src/Web/Frontend.Blazor/Frontend.Blazor.Server
34-
RUN dotnet build --no-restore -c Release -o /app/build
17+
WORKDIR "/src/src/Web/Frontend.Blazor/Frontend.Blazor.Server"
18+
RUN dotnet build "Frontend.Blazor.Server.csproj" -c Release -o /app/build
3519

3620
FROM build AS publish
37-
RUN dotnet publish --no-restore -c Release -o /app/publish
21+
RUN dotnet publish "Frontend.Blazor.Server.csproj" -c Release -o /app/publish
3822

3923
FROM base AS final
4024
WORKDIR /app

src/Web/WebStatus/Dockerfile

Lines changed: 10 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,24 @@
1-
FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base
1+
#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.
2+
3+
FROM mcr.microsoft.com/dotnet/aspnet:5.0 AS base
24
WORKDIR /app
35
EXPOSE 80
46

5-
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
7+
FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build
68
WORKDIR /src
79

8-
COPY "eSchool.sln" "eSchool.sln"
9-
10-
COPY "src/ApiGateways/eSchool.GraphQL/eSchool.GraphQL.csproj" "src/ApiGateways/eSchool.GraphQL/eSchool.GraphQL.csproj"
11-
12-
COPY "src/Services/Enrolling/Enrolling.API/Enrolling.API.csproj" "src/Services/Enrolling/Enrolling.API/Enrolling.API.csproj"
13-
COPY "src/Services/Enrolling/Enrolling.Domain/Enrolling.Domain.csproj" "src/Services/Enrolling/Enrolling.Domain/Enrolling.Domain.csproj"
14-
COPY "src/Services/Enrolling/Enrolling.Infrastructure/Enrolling.Infrastructure.csproj" "src/Services/Enrolling/Enrolling.Infrastructure/Enrolling.Infrastructure.csproj"
15-
COPY "src/Services/Enrolling/Enrolling.UnitTests/Enrolling.UnitTests.csproj" "src/Services/Enrolling/Enrolling.UnitTests/Enrolling.UnitTests.csproj"
16-
COPY "src/Services/Enrolling/Enrolling.FunctionalTests/Enrolling.FunctionalTests.csproj" "src/Services/Enrolling/Enrolling.FunctionalTests/Enrolling.FunctionalTests.csproj"
17-
18-
COPY "src/Services/CertificateProcessing/CertificateProcessing.API/CertificateProcessing.API.csproj" "src/Services/CertificateProcessing/CertificateProcessing.API/CertificateProcessing.API.csproj"
19-
20-
COPY "src/Libraries/OpenTelemetry/OpenTelemetry.csproj" "src/Libraries/OpenTelemetry/OpenTelemetry.csproj"
21-
22-
COPY "src/Web/WebStatus/WebStatus.csproj" "src/Web/WebStatus/WebStatus.csproj"
23-
24-
COPY "src/Web/Frontend.Blazor/Frontend.Blazor.Server/Frontend.Blazor.Server.csproj" "src/Web/Frontend.Blazor/Frontend.Blazor.Server/Frontend.Blazor.Server.csproj"
25-
COPY "src/Web/Frontend.Blazor/Frontend.Blazor.Client/Frontend.Blazor.Client.csproj" "src/Web/Frontend.Blazor/Frontend.Blazor.Client/Frontend.Blazor.Client.csproj"
26-
COPY "src/Web/Frontend.Blazor/Frontend.Blazor.Shared/Frontend.Blazor.Shared.csproj" "src/Web/Frontend.Blazor/Frontend.Blazor.Shared/Frontend.Blazor.Shared.csproj"
27-
28-
COPY "docker-compose.dcproj" "docker-compose.dcproj"
10+
COPY ["src/Web/WebStatus/WebStatus.csproj", "src/Web/WebStatus/"]
2911

30-
RUN dotnet restore eSchool.sln -nowarn:msb3202,nu1503
12+
RUN dotnet restore "src/Web/WebStatus/WebStatus.csproj"
3113

3214
COPY . .
33-
WORKDIR /src/src/Web/WebStatus
34-
RUN dotnet build --no-restore -c Release -o /app
15+
WORKDIR "/src/src/Web/WebStatus"
16+
RUN dotnet build "WebStatus.csproj" -c Release -o /app/build
3517

3618
FROM build AS publish
37-
RUN dotnet publish --no-restore -c Release -o /app
19+
RUN dotnet publish "WebStatus.csproj" -c Release -o /app/publish
3820

3921
FROM base AS final
4022
WORKDIR /app
41-
COPY --from=publish /app .
23+
COPY --from=publish /app/publish .
4224
ENTRYPOINT ["dotnet", "WebStatus.dll"]

0 commit comments

Comments
 (0)