From ee0fd7bb8716eff9f2fb34c12388095f49867c74 Mon Sep 17 00:00:00 2001 From: Ratan Sunder Parai Date: Sat, 5 Jun 2021 12:49:03 +0600 Subject: [PATCH] add docker configurations --- .dockerignore | 25 +++++++++++++++++ docker-compose.dcproj | 18 ++++++++++++ docker-compose.override.yml | 29 +++++++++++++++++++ docker-compose.yml | 29 +++++++++++++++++++ graphql-bff.sln | 31 ++++++++++++++++----- src/Gateway/Graphql.API/Dockerfile | 21 ++++++++++++++ src/Services/Address/Address.API/Dockerfile | 21 ++++++++++++++ src/Services/Payment/Payment.API/Dockerfile | 21 ++++++++++++++ src/Services/Student/Student.API/Dockerfile | 21 ++++++++++++++ 9 files changed, 209 insertions(+), 7 deletions(-) create mode 100644 .dockerignore create mode 100644 docker-compose.dcproj create mode 100644 docker-compose.override.yml create mode 100644 docker-compose.yml create mode 100644 src/Gateway/Graphql.API/Dockerfile create mode 100644 src/Services/Address/Address.API/Dockerfile create mode 100644 src/Services/Payment/Payment.API/Dockerfile create mode 100644 src/Services/Student/Student.API/Dockerfile diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..3729ff0 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,25 @@ +**/.classpath +**/.dockerignore +**/.env +**/.git +**/.gitignore +**/.project +**/.settings +**/.toolstarget +**/.vs +**/.vscode +**/*.*proj.user +**/*.dbmdl +**/*.jfm +**/azds.yaml +**/bin +**/charts +**/docker-compose* +**/Dockerfile* +**/node_modules +**/npm-debug.log +**/obj +**/secrets.dev.yaml +**/values.dev.yaml +LICENSE +README.md \ No newline at end of file diff --git a/docker-compose.dcproj b/docker-compose.dcproj new file mode 100644 index 0000000..e4cdeba --- /dev/null +++ b/docker-compose.dcproj @@ -0,0 +1,18 @@ + + + + 2.1 + Linux + 1eab640a-1fcc-4cde-957e-1ac0a6e6b7ab + LaunchBrowser + {Scheme}://localhost:{ServicePort}/swagger + graphql.api + + + + docker-compose.yml + + + + + \ No newline at end of file diff --git a/docker-compose.override.yml b/docker-compose.override.yml new file mode 100644 index 0000000..2f256cc --- /dev/null +++ b/docker-compose.override.yml @@ -0,0 +1,29 @@ +version: '3.4' + +services: + graphql.api: + environment: + - ASPNETCORE_ENVIRONMENT=Development + ports: + - "7000:80" + + address.api: + environment: + - ASPNETCORE_ENVIRONMENT=Development + ports: + - "7001:80" + + + payment.api: + environment: + - ASPNETCORE_ENVIRONMENT=Development + ports: + - "7002:80" + + + student.api: + environment: + - ASPNETCORE_ENVIRONMENT=Development + ports: + - "7003:80" + diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..b1832a5 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,29 @@ +version: '3.4' + +services: + graphql.api: + image: ${DOCKER_REGISTRY-}graphqlapi + build: + context: . + dockerfile: src/Gateway/Graphql.API/Dockerfile + + address.api: + image: ${DOCKER_REGISTRY-}addressapi + build: + context: . + dockerfile: src/Services/Address/Address.API/Dockerfile + + + payment.api: + image: ${DOCKER_REGISTRY-}paymentapi + build: + context: . + dockerfile: src/Services/Payment/Payment.API/Dockerfile + + + student.api: + image: ${DOCKER_REGISTRY-}studentapi + build: + context: . + dockerfile: src/Services/Student/Student.API/Dockerfile + diff --git a/graphql-bff.sln b/graphql-bff.sln index 09c2891..d1fc867 100644 --- a/graphql-bff.sln +++ b/graphql-bff.sln @@ -7,21 +7,23 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{31ABBD13-5B2 EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Gateway", "Gateway", "{8C9CE111-2854-4321-A159-91E7DD2E2874}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Graphql.API", "src\Gateway\Graphql.API\Graphql.API.csproj", "{78221D7E-D3B2-4755-B359-C60989036186}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Graphql.API", "src\Gateway\Graphql.API\Graphql.API.csproj", "{78221D7E-D3B2-4755-B359-C60989036186}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Services", "Services", "{E97856A9-79F8-4118-A86F-26A15C44E731}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Student", "Student", "{0F6109DC-C231-4DA5-AB99-011B78629BFD}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Student.API", "src\Services\Student\Student.API\Student.API.csproj", "{1540F9F4-2EC2-441E-92F4-29774F902B31}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Student.API", "src\Services\Student\Student.API\Student.API.csproj", "{1540F9F4-2EC2-441E-92F4-29774F902B31}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Payment", "Payment", "{C3778DEF-F1E2-4772-AAAC-6EED4EC4280A}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Payment.API", "src\Services\Payment\Payment.API\Payment.API.csproj", "{F9C405C4-3C3C-4F56-8307-C56BD46640B6}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Payment.API", "src\Services\Payment\Payment.API\Payment.API.csproj", "{F9C405C4-3C3C-4F56-8307-C56BD46640B6}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Address", "Address", "{6B39C3F0-FA20-4B69-8240-07A1FFCEBB1D}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Address.API", "src\Services\Address\Address.API\Address.API.csproj", "{A47CE2E7-C532-4FC6-92D4-133F20E4DD61}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Address.API", "src\Services\Address\Address.API\Address.API.csproj", "{A47CE2E7-C532-4FC6-92D4-133F20E4DD61}" +EndProject +Project("{E53339B2-1760-4266-BCC7-CA923CBCF16C}") = "docker-compose", "docker-compose.dcproj", "{1EAB640A-1FCC-4CDE-957E-1AC0A6E6B7AB}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -32,9 +34,6 @@ Global Release|x64 = Release|x64 Release|x86 = Release|x86 EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {78221D7E-D3B2-4755-B359-C60989036186}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {78221D7E-D3B2-4755-B359-C60989036186}.Debug|Any CPU.Build.0 = Debug|Any CPU @@ -84,6 +83,21 @@ Global {A47CE2E7-C532-4FC6-92D4-133F20E4DD61}.Release|x64.Build.0 = Release|Any CPU {A47CE2E7-C532-4FC6-92D4-133F20E4DD61}.Release|x86.ActiveCfg = Release|Any CPU {A47CE2E7-C532-4FC6-92D4-133F20E4DD61}.Release|x86.Build.0 = Release|Any CPU + {1EAB640A-1FCC-4CDE-957E-1AC0A6E6B7AB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1EAB640A-1FCC-4CDE-957E-1AC0A6E6B7AB}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1EAB640A-1FCC-4CDE-957E-1AC0A6E6B7AB}.Debug|x64.ActiveCfg = Debug|Any CPU + {1EAB640A-1FCC-4CDE-957E-1AC0A6E6B7AB}.Debug|x64.Build.0 = Debug|Any CPU + {1EAB640A-1FCC-4CDE-957E-1AC0A6E6B7AB}.Debug|x86.ActiveCfg = Debug|Any CPU + {1EAB640A-1FCC-4CDE-957E-1AC0A6E6B7AB}.Debug|x86.Build.0 = Debug|Any CPU + {1EAB640A-1FCC-4CDE-957E-1AC0A6E6B7AB}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1EAB640A-1FCC-4CDE-957E-1AC0A6E6B7AB}.Release|Any CPU.Build.0 = Release|Any CPU + {1EAB640A-1FCC-4CDE-957E-1AC0A6E6B7AB}.Release|x64.ActiveCfg = Release|Any CPU + {1EAB640A-1FCC-4CDE-957E-1AC0A6E6B7AB}.Release|x64.Build.0 = Release|Any CPU + {1EAB640A-1FCC-4CDE-957E-1AC0A6E6B7AB}.Release|x86.ActiveCfg = Release|Any CPU + {1EAB640A-1FCC-4CDE-957E-1AC0A6E6B7AB}.Release|x86.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE EndGlobalSection GlobalSection(NestedProjects) = preSolution {8C9CE111-2854-4321-A159-91E7DD2E2874} = {31ABBD13-5B20-4051-90A0-BB10100A004D} @@ -96,4 +110,7 @@ Global {6B39C3F0-FA20-4B69-8240-07A1FFCEBB1D} = {E97856A9-79F8-4118-A86F-26A15C44E731} {A47CE2E7-C532-4FC6-92D4-133F20E4DD61} = {6B39C3F0-FA20-4B69-8240-07A1FFCEBB1D} EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {834D42E7-8173-4415-85BE-C8844CFE2A86} + EndGlobalSection EndGlobal diff --git a/src/Gateway/Graphql.API/Dockerfile b/src/Gateway/Graphql.API/Dockerfile new file mode 100644 index 0000000..b94d274 --- /dev/null +++ b/src/Gateway/Graphql.API/Dockerfile @@ -0,0 +1,21 @@ +#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging. + +FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base +WORKDIR /app +EXPOSE 80 + +FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build +WORKDIR /src +COPY ["src/Gateway/Graphql.API/Graphql.API.csproj", "src/Gateway/Graphql.API/"] +RUN dotnet restore "src/Gateway/Graphql.API/Graphql.API.csproj" +COPY . . +WORKDIR "/src/src/Gateway/Graphql.API" +RUN dotnet build "Graphql.API.csproj" -c Release -o /app/build + +FROM build AS publish +RUN dotnet publish "Graphql.API.csproj" -c Release -o /app/publish + +FROM base AS final +WORKDIR /app +COPY --from=publish /app/publish . +ENTRYPOINT ["dotnet", "Graphql.API.dll"] diff --git a/src/Services/Address/Address.API/Dockerfile b/src/Services/Address/Address.API/Dockerfile new file mode 100644 index 0000000..cae3f75 --- /dev/null +++ b/src/Services/Address/Address.API/Dockerfile @@ -0,0 +1,21 @@ +#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging. + +FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base +WORKDIR /app +EXPOSE 80 + +FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build +WORKDIR /src +COPY ["src/Services/Address/Address.API/Address.API.csproj", "src/Services/Address/Address.API/"] +RUN dotnet restore "src/Services/Address/Address.API/Address.API.csproj" +COPY . . +WORKDIR "/src/src/Services/Address/Address.API" +RUN dotnet build "Address.API.csproj" -c Release -o /app/build + +FROM build AS publish +RUN dotnet publish "Address.API.csproj" -c Release -o /app/publish + +FROM base AS final +WORKDIR /app +COPY --from=publish /app/publish . +ENTRYPOINT ["dotnet", "Address.API.dll"] diff --git a/src/Services/Payment/Payment.API/Dockerfile b/src/Services/Payment/Payment.API/Dockerfile new file mode 100644 index 0000000..ebb8382 --- /dev/null +++ b/src/Services/Payment/Payment.API/Dockerfile @@ -0,0 +1,21 @@ +#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging. + +FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base +WORKDIR /app +EXPOSE 80 + +FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build +WORKDIR /src +COPY ["src/Services/Payment/Payment.API/Payment.API.csproj", "src/Services/Payment/Payment.API/"] +RUN dotnet restore "src/Services/Payment/Payment.API/Payment.API.csproj" +COPY . . +WORKDIR "/src/src/Services/Payment/Payment.API" +RUN dotnet build "Payment.API.csproj" -c Release -o /app/build + +FROM build AS publish +RUN dotnet publish "Payment.API.csproj" -c Release -o /app/publish + +FROM base AS final +WORKDIR /app +COPY --from=publish /app/publish . +ENTRYPOINT ["dotnet", "Payment.API.dll"] diff --git a/src/Services/Student/Student.API/Dockerfile b/src/Services/Student/Student.API/Dockerfile new file mode 100644 index 0000000..6840951 --- /dev/null +++ b/src/Services/Student/Student.API/Dockerfile @@ -0,0 +1,21 @@ +#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging. + +FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base +WORKDIR /app +EXPOSE 80 + +FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build +WORKDIR /src +COPY ["src/Services/Student/Student.API/Student.API.csproj", "src/Services/Student/Student.API/"] +RUN dotnet restore "src/Services/Student/Student.API/Student.API.csproj" +COPY . . +WORKDIR "/src/src/Services/Student/Student.API" +RUN dotnet build "Student.API.csproj" -c Release -o /app/build + +FROM build AS publish +RUN dotnet publish "Student.API.csproj" -c Release -o /app/publish + +FROM base AS final +WORKDIR /app +COPY --from=publish /app/publish . +ENTRYPOINT ["dotnet", "Student.API.dll"]