From 121e4bbcd2f306c5fc8d44c096040b0d0078c288 Mon Sep 17 00:00:00 2001 From: Zara28 Date: Tue, 17 Sep 2024 22:46:46 +0400 Subject: [PATCH] dozorova_alena_lab_2 --- .gitignore | 9 +++ .../ConsoleApp1/.dockerignore | 30 ++++++++ .../ConsoleApp1/ConsoleApp1.csproj | 13 ++++ .../ConsoleApp1/ConsoleApp1.csproj.user | 7 ++ .../ConsoleApp1/ConsoleApp1.sln | 25 +++++++ dozorova_alena_lab_2/ConsoleApp1/Dockerfile | 22 ++++++ dozorova_alena_lab_2/ConsoleApp1/Program.cs | 32 +++++++++ .../Properties/launchSettings.json | 10 +++ .../ConsoleApp2/.dockerignore | 30 ++++++++ .../ConsoleApp2/ConsoleApp2.csproj | 16 +++++ .../ConsoleApp2/ConsoleApp2.csproj.user | 6 ++ .../ConsoleApp2/ConsoleApp2.sln | 25 +++++++ dozorova_alena_lab_2/ConsoleApp2/Dockerfile | 22 ++++++ dozorova_alena_lab_2/ConsoleApp2/Program.cs | 16 +++++ .../Properties/launchSettings.json | 10 +++ dozorova_alena_lab_2/FilesInput/First/0.txt | 1 + dozorova_alena_lab_2/FilesInput/First/1.txt | 1 + dozorova_alena_lab_2/FilesInput/First/10.txt | 1 + dozorova_alena_lab_2/FilesInput/First/11.txt | 1 + dozorova_alena_lab_2/FilesInput/First/12.txt | 1 + dozorova_alena_lab_2/FilesInput/First/13.txt | 1 + dozorova_alena_lab_2/FilesInput/First/14.txt | 1 + dozorova_alena_lab_2/FilesInput/First/15.txt | 1 + dozorova_alena_lab_2/FilesInput/First/16.txt | 1 + dozorova_alena_lab_2/FilesInput/First/17.txt | 1 + dozorova_alena_lab_2/FilesInput/First/18.txt | 1 + dozorova_alena_lab_2/FilesInput/First/19.txt | 1 + dozorova_alena_lab_2/FilesInput/First/2.txt | 1 + dozorova_alena_lab_2/FilesInput/First/20.txt | 1 + dozorova_alena_lab_2/FilesInput/First/21.txt | 1 + dozorova_alena_lab_2/FilesInput/First/22.txt | 1 + dozorova_alena_lab_2/FilesInput/First/23.txt | 1 + dozorova_alena_lab_2/FilesInput/First/24.txt | 1 + dozorova_alena_lab_2/FilesInput/First/25.txt | 1 + dozorova_alena_lab_2/FilesInput/First/26.txt | 1 + dozorova_alena_lab_2/FilesInput/First/27.txt | 1 + dozorova_alena_lab_2/FilesInput/First/28.txt | 1 + dozorova_alena_lab_2/FilesInput/First/29.txt | 1 + dozorova_alena_lab_2/FilesInput/First/3.txt | 1 + dozorova_alena_lab_2/FilesInput/First/30.txt | 1 + dozorova_alena_lab_2/FilesInput/First/31.txt | 1 + dozorova_alena_lab_2/FilesInput/First/32.txt | 1 + dozorova_alena_lab_2/FilesInput/First/33.txt | 1 + dozorova_alena_lab_2/FilesInput/First/34.txt | 1 + dozorova_alena_lab_2/FilesInput/First/35.txt | 1 + dozorova_alena_lab_2/FilesInput/First/36.txt | 1 + dozorova_alena_lab_2/FilesInput/First/37.txt | 1 + dozorova_alena_lab_2/FilesInput/First/38.txt | 1 + dozorova_alena_lab_2/FilesInput/First/4.txt | 1 + dozorova_alena_lab_2/FilesInput/First/5.txt | 1 + dozorova_alena_lab_2/FilesInput/First/6.txt | 1 + dozorova_alena_lab_2/FilesInput/First/7.txt | 1 + dozorova_alena_lab_2/FilesInput/First/8.txt | 1 + dozorova_alena_lab_2/FilesInput/First/9.txt | 1 + .../FilesInput/Second/data.txt | 1 + dozorova_alena_lab_2/FilesOutput/result.txt | 1 + dozorova_alena_lab_2/docker-compose.yml | 14 ++++ dozorova_alena_lab_2/readme.md | 70 +++++++++++++++++++ 58 files changed, 398 insertions(+) create mode 100644 .gitignore create mode 100644 dozorova_alena_lab_2/ConsoleApp1/.dockerignore create mode 100644 dozorova_alena_lab_2/ConsoleApp1/ConsoleApp1.csproj create mode 100644 dozorova_alena_lab_2/ConsoleApp1/ConsoleApp1.csproj.user create mode 100644 dozorova_alena_lab_2/ConsoleApp1/ConsoleApp1.sln create mode 100644 dozorova_alena_lab_2/ConsoleApp1/Dockerfile create mode 100644 dozorova_alena_lab_2/ConsoleApp1/Program.cs create mode 100644 dozorova_alena_lab_2/ConsoleApp1/Properties/launchSettings.json create mode 100644 dozorova_alena_lab_2/ConsoleApp2/.dockerignore create mode 100644 dozorova_alena_lab_2/ConsoleApp2/ConsoleApp2.csproj create mode 100644 dozorova_alena_lab_2/ConsoleApp2/ConsoleApp2.csproj.user create mode 100644 dozorova_alena_lab_2/ConsoleApp2/ConsoleApp2.sln create mode 100644 dozorova_alena_lab_2/ConsoleApp2/Dockerfile create mode 100644 dozorova_alena_lab_2/ConsoleApp2/Program.cs create mode 100644 dozorova_alena_lab_2/ConsoleApp2/Properties/launchSettings.json create mode 100644 dozorova_alena_lab_2/FilesInput/First/0.txt create mode 100644 dozorova_alena_lab_2/FilesInput/First/1.txt create mode 100644 dozorova_alena_lab_2/FilesInput/First/10.txt create mode 100644 dozorova_alena_lab_2/FilesInput/First/11.txt create mode 100644 dozorova_alena_lab_2/FilesInput/First/12.txt create mode 100644 dozorova_alena_lab_2/FilesInput/First/13.txt create mode 100644 dozorova_alena_lab_2/FilesInput/First/14.txt create mode 100644 dozorova_alena_lab_2/FilesInput/First/15.txt create mode 100644 dozorova_alena_lab_2/FilesInput/First/16.txt create mode 100644 dozorova_alena_lab_2/FilesInput/First/17.txt create mode 100644 dozorova_alena_lab_2/FilesInput/First/18.txt create mode 100644 dozorova_alena_lab_2/FilesInput/First/19.txt create mode 100644 dozorova_alena_lab_2/FilesInput/First/2.txt create mode 100644 dozorova_alena_lab_2/FilesInput/First/20.txt create mode 100644 dozorova_alena_lab_2/FilesInput/First/21.txt create mode 100644 dozorova_alena_lab_2/FilesInput/First/22.txt create mode 100644 dozorova_alena_lab_2/FilesInput/First/23.txt create mode 100644 dozorova_alena_lab_2/FilesInput/First/24.txt create mode 100644 dozorova_alena_lab_2/FilesInput/First/25.txt create mode 100644 dozorova_alena_lab_2/FilesInput/First/26.txt create mode 100644 dozorova_alena_lab_2/FilesInput/First/27.txt create mode 100644 dozorova_alena_lab_2/FilesInput/First/28.txt create mode 100644 dozorova_alena_lab_2/FilesInput/First/29.txt create mode 100644 dozorova_alena_lab_2/FilesInput/First/3.txt create mode 100644 dozorova_alena_lab_2/FilesInput/First/30.txt create mode 100644 dozorova_alena_lab_2/FilesInput/First/31.txt create mode 100644 dozorova_alena_lab_2/FilesInput/First/32.txt create mode 100644 dozorova_alena_lab_2/FilesInput/First/33.txt create mode 100644 dozorova_alena_lab_2/FilesInput/First/34.txt create mode 100644 dozorova_alena_lab_2/FilesInput/First/35.txt create mode 100644 dozorova_alena_lab_2/FilesInput/First/36.txt create mode 100644 dozorova_alena_lab_2/FilesInput/First/37.txt create mode 100644 dozorova_alena_lab_2/FilesInput/First/38.txt create mode 100644 dozorova_alena_lab_2/FilesInput/First/4.txt create mode 100644 dozorova_alena_lab_2/FilesInput/First/5.txt create mode 100644 dozorova_alena_lab_2/FilesInput/First/6.txt create mode 100644 dozorova_alena_lab_2/FilesInput/First/7.txt create mode 100644 dozorova_alena_lab_2/FilesInput/First/8.txt create mode 100644 dozorova_alena_lab_2/FilesInput/First/9.txt create mode 100644 dozorova_alena_lab_2/FilesInput/Second/data.txt create mode 100644 dozorova_alena_lab_2/FilesOutput/result.txt create mode 100644 dozorova_alena_lab_2/docker-compose.yml create mode 100644 dozorova_alena_lab_2/readme.md diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..697082a --- /dev/null +++ b/.gitignore @@ -0,0 +1,9 @@ + +/dozorova_alena_lab_2/.vs +/dozorova_alena_lab_2/ConsoleApp1/.vs +/dozorova_alena_lab_2/ConsoleApp1/bin +/dozorova_alena_lab_2/ConsoleApp1/obj +/dozorova_alena_lab_2/ConsoleApp1/Properties/PublishProfiles +/dozorova_alena_lab_2/ConsoleApp2/.vs +/dozorova_alena_lab_2/ConsoleApp2/bin +/dozorova_alena_lab_2/ConsoleApp2/obj diff --git a/dozorova_alena_lab_2/ConsoleApp1/.dockerignore b/dozorova_alena_lab_2/ConsoleApp1/.dockerignore new file mode 100644 index 0000000..fe1152b --- /dev/null +++ b/dozorova_alena_lab_2/ConsoleApp1/.dockerignore @@ -0,0 +1,30 @@ +**/.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 +!**/.gitignore +!.git/HEAD +!.git/config +!.git/packed-refs +!.git/refs/heads/** \ No newline at end of file diff --git a/dozorova_alena_lab_2/ConsoleApp1/ConsoleApp1.csproj b/dozorova_alena_lab_2/ConsoleApp1/ConsoleApp1.csproj new file mode 100644 index 0000000..599ec87 --- /dev/null +++ b/dozorova_alena_lab_2/ConsoleApp1/ConsoleApp1.csproj @@ -0,0 +1,13 @@ + + + Exe + net6.0 + enable + enable + Linux + . + + + + + \ No newline at end of file diff --git a/dozorova_alena_lab_2/ConsoleApp1/ConsoleApp1.csproj.user b/dozorova_alena_lab_2/ConsoleApp1/ConsoleApp1.csproj.user new file mode 100644 index 0000000..6c031cb --- /dev/null +++ b/dozorova_alena_lab_2/ConsoleApp1/ConsoleApp1.csproj.user @@ -0,0 +1,7 @@ + + + + Container (Dockerfile) + <_LastSelectedProfileId>C:\Users\Alena\WorkFolder\Study\politech\7\РВиП\DAS_2024_1\dozorova_alena_lab_2\ConsoleApp1\Properties\PublishProfiles\registry.hub.docker.com_alenadozorova.pubxml + + \ No newline at end of file diff --git a/dozorova_alena_lab_2/ConsoleApp1/ConsoleApp1.sln b/dozorova_alena_lab_2/ConsoleApp1/ConsoleApp1.sln new file mode 100644 index 0000000..12f3d98 --- /dev/null +++ b/dozorova_alena_lab_2/ConsoleApp1/ConsoleApp1.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.10.35004.147 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConsoleApp1", "ConsoleApp1.csproj", "{093B5FCB-33F6-4F14-B150-87DA092D2BFA}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {093B5FCB-33F6-4F14-B150-87DA092D2BFA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {093B5FCB-33F6-4F14-B150-87DA092D2BFA}.Debug|Any CPU.Build.0 = Debug|Any CPU + {093B5FCB-33F6-4F14-B150-87DA092D2BFA}.Release|Any CPU.ActiveCfg = Release|Any CPU + {093B5FCB-33F6-4F14-B150-87DA092D2BFA}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {CDC30087-C732-4ED0-97FB-E43A9F219F67} + EndGlobalSection +EndGlobal diff --git a/dozorova_alena_lab_2/ConsoleApp1/Dockerfile b/dozorova_alena_lab_2/ConsoleApp1/Dockerfile new file mode 100644 index 0000000..6bbf72d --- /dev/null +++ b/dozorova_alena_lab_2/ConsoleApp1/Dockerfile @@ -0,0 +1,22 @@ +#See https://aka.ms/customizecontainer to learn how to customize your debug container and how Visual Studio uses this Dockerfile to build your images for faster debugging. + +FROM mcr.microsoft.com/dotnet/runtime:6.0 AS base +WORKDIR /app + +FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build +ARG BUILD_CONFIGURATION=Release +WORKDIR /src +COPY ["ConsoleApp1.csproj", "."] +RUN dotnet restore "./ConsoleApp1.csproj" +COPY . . +WORKDIR "/src/." +RUN dotnet build "./ConsoleApp1.csproj" -c $BUILD_CONFIGURATION -o /app/build + +FROM build AS publish +ARG BUILD_CONFIGURATION=Release +RUN dotnet publish "./ConsoleApp1.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false + +FROM base AS final +WORKDIR /app +COPY --from=publish /app/publish . +ENTRYPOINT ["dotnet", "ConsoleApp1.dll"] \ No newline at end of file diff --git a/dozorova_alena_lab_2/ConsoleApp1/Program.cs b/dozorova_alena_lab_2/ConsoleApp1/Program.cs new file mode 100644 index 0000000..5440c09 --- /dev/null +++ b/dozorova_alena_lab_2/ConsoleApp1/Program.cs @@ -0,0 +1,32 @@ +// Ищет в каталоге /var/data файл с самым коротким названием и перекладывает +// его в /var/result/data.txt. + +Console.WriteLine("Start first service"); +var files = Directory.GetFiles("/var/data/"); + +if(files == null || files.Length == 0) +{ + File.Create("./var/data/data.txt"); +} + +string res = files[0]; + +files.ToList().ForEach(f => +{ + if(res.Length > f.Length) + { + res = f; + } +}); + +Console.WriteLine("Find file " + res); + +if(!Directory.Exists("/var/result")) +{ + Directory.CreateDirectory("/var/result"); +} + +File.Copy(res, "/var/result/data.txt"); + +Console.WriteLine("Copy to /var/result/data.txt"); + diff --git a/dozorova_alena_lab_2/ConsoleApp1/Properties/launchSettings.json b/dozorova_alena_lab_2/ConsoleApp1/Properties/launchSettings.json new file mode 100644 index 0000000..1fc0367 --- /dev/null +++ b/dozorova_alena_lab_2/ConsoleApp1/Properties/launchSettings.json @@ -0,0 +1,10 @@ +{ + "profiles": { + "ConsoleApp1": { + "commandName": "Project" + }, + "Container (Dockerfile)": { + "commandName": "Docker" + } + } +} \ No newline at end of file diff --git a/dozorova_alena_lab_2/ConsoleApp2/.dockerignore b/dozorova_alena_lab_2/ConsoleApp2/.dockerignore new file mode 100644 index 0000000..fe1152b --- /dev/null +++ b/dozorova_alena_lab_2/ConsoleApp2/.dockerignore @@ -0,0 +1,30 @@ +**/.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 +!**/.gitignore +!.git/HEAD +!.git/config +!.git/packed-refs +!.git/refs/heads/** \ No newline at end of file diff --git a/dozorova_alena_lab_2/ConsoleApp2/ConsoleApp2.csproj b/dozorova_alena_lab_2/ConsoleApp2/ConsoleApp2.csproj new file mode 100644 index 0000000..7be2204 --- /dev/null +++ b/dozorova_alena_lab_2/ConsoleApp2/ConsoleApp2.csproj @@ -0,0 +1,16 @@ + + + + Exe + net6.0 + enable + enable + Linux + . + + + + + + + diff --git a/dozorova_alena_lab_2/ConsoleApp2/ConsoleApp2.csproj.user b/dozorova_alena_lab_2/ConsoleApp2/ConsoleApp2.csproj.user new file mode 100644 index 0000000..dd2d54c --- /dev/null +++ b/dozorova_alena_lab_2/ConsoleApp2/ConsoleApp2.csproj.user @@ -0,0 +1,6 @@ + + + + Container (Dockerfile) + + \ No newline at end of file diff --git a/dozorova_alena_lab_2/ConsoleApp2/ConsoleApp2.sln b/dozorova_alena_lab_2/ConsoleApp2/ConsoleApp2.sln new file mode 100644 index 0000000..8337ab4 --- /dev/null +++ b/dozorova_alena_lab_2/ConsoleApp2/ConsoleApp2.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.10.35004.147 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConsoleApp2", "ConsoleApp2.csproj", "{364FF6E2-3AED-4C3A-B2DD-D20CA9214BB8}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {364FF6E2-3AED-4C3A-B2DD-D20CA9214BB8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {364FF6E2-3AED-4C3A-B2DD-D20CA9214BB8}.Debug|Any CPU.Build.0 = Debug|Any CPU + {364FF6E2-3AED-4C3A-B2DD-D20CA9214BB8}.Release|Any CPU.ActiveCfg = Release|Any CPU + {364FF6E2-3AED-4C3A-B2DD-D20CA9214BB8}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {E5B491A6-064F-48E0-ACBD-E1B4FE3D0898} + EndGlobalSection +EndGlobal diff --git a/dozorova_alena_lab_2/ConsoleApp2/Dockerfile b/dozorova_alena_lab_2/ConsoleApp2/Dockerfile new file mode 100644 index 0000000..3d0b78d --- /dev/null +++ b/dozorova_alena_lab_2/ConsoleApp2/Dockerfile @@ -0,0 +1,22 @@ +#See https://aka.ms/customizecontainer to learn how to customize your debug container and how Visual Studio uses this Dockerfile to build your images for faster debugging. + +FROM mcr.microsoft.com/dotnet/runtime:6.0 AS base +WORKDIR /app + +FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build +ARG BUILD_CONFIGURATION=Release +WORKDIR /src +COPY ["ConsoleApp2.csproj", "."] +RUN dotnet restore "./ConsoleApp2.csproj" +COPY . . +WORKDIR "/src/." +RUN dotnet build "./ConsoleApp2.csproj" -c $BUILD_CONFIGURATION -o /app/build + +FROM build AS publish +ARG BUILD_CONFIGURATION=Release +RUN dotnet publish "./ConsoleApp2.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false + +FROM base AS final +WORKDIR /app +COPY --from=publish /app/publish . +ENTRYPOINT ["dotnet", "ConsoleApp2.dll"] \ No newline at end of file diff --git a/dozorova_alena_lab_2/ConsoleApp2/Program.cs b/dozorova_alena_lab_2/ConsoleApp2/Program.cs new file mode 100644 index 0000000..ccbf2e3 --- /dev/null +++ b/dozorova_alena_lab_2/ConsoleApp2/Program.cs @@ -0,0 +1,16 @@ +// Ищет набольшее число из файла /var/data/data.txt и сохраняет +// его вторую степень в /var/result/result.txt. +Console.WriteLine("Start second service"); +var data = File.ReadAllText("/var/data/data.txt").Split(" ").ToList(); + +var max = data.Select(x => Int32.TryParse(x, out int value) ? value : 0).Max(); + +Console.WriteLine("Find max value: "+max); +if(!Directory.Exists("/var/result/")) +{ + Directory.CreateDirectory("/var/result/"); +} + +File.WriteAllText("/var/result/result.txt", Math.Pow(max, 2).ToString()); + +Console.WriteLine("Save to /var/result/result.txt"); \ No newline at end of file diff --git a/dozorova_alena_lab_2/ConsoleApp2/Properties/launchSettings.json b/dozorova_alena_lab_2/ConsoleApp2/Properties/launchSettings.json new file mode 100644 index 0000000..7d85e14 --- /dev/null +++ b/dozorova_alena_lab_2/ConsoleApp2/Properties/launchSettings.json @@ -0,0 +1,10 @@ +{ + "profiles": { + "ConsoleApp2": { + "commandName": "Project" + }, + "Container (Dockerfile)": { + "commandName": "Docker" + } + } +} \ No newline at end of file diff --git a/dozorova_alena_lab_2/FilesInput/First/0.txt b/dozorova_alena_lab_2/FilesInput/First/0.txt new file mode 100644 index 0000000..85b45be --- /dev/null +++ b/dozorova_alena_lab_2/FilesInput/First/0.txt @@ -0,0 +1 @@ +52 32 22 57 23 30 63 22 27 32 10 0 58 40 83 86 21 87 84 27 44 31 59 35 37 57 21 97 87 7 23 89 27 35 55 9 14 35 59 \ No newline at end of file diff --git a/dozorova_alena_lab_2/FilesInput/First/1.txt b/dozorova_alena_lab_2/FilesInput/First/1.txt new file mode 100644 index 0000000..252c02b --- /dev/null +++ b/dozorova_alena_lab_2/FilesInput/First/1.txt @@ -0,0 +1 @@ +93 95 67 2 81 16 46 47 40 43 93 71 16 63 6 86 94 8 55 32 59 28 71 43 39 29 60 23 43 75 67 70 73 50 75 65 10 99 41 \ No newline at end of file diff --git a/dozorova_alena_lab_2/FilesInput/First/10.txt b/dozorova_alena_lab_2/FilesInput/First/10.txt new file mode 100644 index 0000000..35d8815 --- /dev/null +++ b/dozorova_alena_lab_2/FilesInput/First/10.txt @@ -0,0 +1 @@ +48 88 38 25 7 96 34 30 92 34 97 0 81 41 94 85 4 82 77 23 41 8 78 93 38 12 27 55 97 46 20 52 88 54 35 72 62 28 43 \ No newline at end of file diff --git a/dozorova_alena_lab_2/FilesInput/First/11.txt b/dozorova_alena_lab_2/FilesInput/First/11.txt new file mode 100644 index 0000000..2de3f85 --- /dev/null +++ b/dozorova_alena_lab_2/FilesInput/First/11.txt @@ -0,0 +1 @@ +14 3 92 80 29 21 88 21 98 41 64 10 73 57 31 27 92 84 53 37 35 27 60 52 54 90 89 4 90 95 26 79 55 31 34 17 26 90 49 \ No newline at end of file diff --git a/dozorova_alena_lab_2/FilesInput/First/12.txt b/dozorova_alena_lab_2/FilesInput/First/12.txt new file mode 100644 index 0000000..cb6764e --- /dev/null +++ b/dozorova_alena_lab_2/FilesInput/First/12.txt @@ -0,0 +1 @@ +66 33 75 48 42 37 2 29 34 77 0 11 59 38 61 80 85 29 50 59 14 64 37 91 65 65 3 14 41 19 13 49 42 30 55 69 81 8 39 \ No newline at end of file diff --git a/dozorova_alena_lab_2/FilesInput/First/13.txt b/dozorova_alena_lab_2/FilesInput/First/13.txt new file mode 100644 index 0000000..83eea89 --- /dev/null +++ b/dozorova_alena_lab_2/FilesInput/First/13.txt @@ -0,0 +1 @@ +57 54 24 59 80 67 13 95 86 96 58 60 32 20 79 56 5 98 27 5 71 92 1 54 47 85 33 87 97 41 49 52 35 86 60 21 64 76 75 \ No newline at end of file diff --git a/dozorova_alena_lab_2/FilesInput/First/14.txt b/dozorova_alena_lab_2/FilesInput/First/14.txt new file mode 100644 index 0000000..b69c830 --- /dev/null +++ b/dozorova_alena_lab_2/FilesInput/First/14.txt @@ -0,0 +1 @@ +75 57 65 15 61 79 94 34 49 33 25 58 91 55 91 81 64 50 25 46 87 44 28 65 15 68 94 56 58 2 40 39 14 29 35 24 9 48 65 \ No newline at end of file diff --git a/dozorova_alena_lab_2/FilesInput/First/15.txt b/dozorova_alena_lab_2/FilesInput/First/15.txt new file mode 100644 index 0000000..4293908 --- /dev/null +++ b/dozorova_alena_lab_2/FilesInput/First/15.txt @@ -0,0 +1 @@ +91 31 90 98 76 35 61 95 67 78 23 91 26 33 2 44 93 20 90 14 33 22 19 35 57 65 81 62 91 84 69 74 55 34 63 98 64 4 77 \ No newline at end of file diff --git a/dozorova_alena_lab_2/FilesInput/First/16.txt b/dozorova_alena_lab_2/FilesInput/First/16.txt new file mode 100644 index 0000000..bcfad3f --- /dev/null +++ b/dozorova_alena_lab_2/FilesInput/First/16.txt @@ -0,0 +1 @@ +41 11 46 24 85 69 93 45 33 33 97 31 91 75 43 60 32 3 76 58 70 66 97 7 75 14 62 1 32 17 54 79 3 59 67 15 43 92 43 \ No newline at end of file diff --git a/dozorova_alena_lab_2/FilesInput/First/17.txt b/dozorova_alena_lab_2/FilesInput/First/17.txt new file mode 100644 index 0000000..899f58f --- /dev/null +++ b/dozorova_alena_lab_2/FilesInput/First/17.txt @@ -0,0 +1 @@ +36 88 91 3 42 4 87 65 42 10 95 54 71 79 60 9 5 63 87 27 75 79 67 45 89 32 65 38 64 22 73 78 48 57 89 28 81 58 18 \ No newline at end of file diff --git a/dozorova_alena_lab_2/FilesInput/First/18.txt b/dozorova_alena_lab_2/FilesInput/First/18.txt new file mode 100644 index 0000000..599a026 --- /dev/null +++ b/dozorova_alena_lab_2/FilesInput/First/18.txt @@ -0,0 +1 @@ +39 86 99 32 34 57 95 27 73 90 80 62 85 91 50 24 54 36 15 87 6 54 63 63 78 10 18 90 9 20 14 57 54 4 97 22 80 50 24 \ No newline at end of file diff --git a/dozorova_alena_lab_2/FilesInput/First/19.txt b/dozorova_alena_lab_2/FilesInput/First/19.txt new file mode 100644 index 0000000..c5a78c4 --- /dev/null +++ b/dozorova_alena_lab_2/FilesInput/First/19.txt @@ -0,0 +1 @@ +32 65 91 95 28 84 23 47 63 3 78 70 48 15 17 58 22 20 67 58 27 24 68 97 3 55 57 9 18 85 14 16 23 10 1 97 24 64 83 \ No newline at end of file diff --git a/dozorova_alena_lab_2/FilesInput/First/2.txt b/dozorova_alena_lab_2/FilesInput/First/2.txt new file mode 100644 index 0000000..a933198 --- /dev/null +++ b/dozorova_alena_lab_2/FilesInput/First/2.txt @@ -0,0 +1 @@ +50 60 55 6 46 82 92 76 47 53 94 93 58 71 54 68 83 56 32 39 96 9 31 93 30 72 88 15 1 45 5 98 64 83 45 60 73 69 74 \ No newline at end of file diff --git a/dozorova_alena_lab_2/FilesInput/First/20.txt b/dozorova_alena_lab_2/FilesInput/First/20.txt new file mode 100644 index 0000000..b6d09fa --- /dev/null +++ b/dozorova_alena_lab_2/FilesInput/First/20.txt @@ -0,0 +1 @@ +26 79 84 64 17 53 9 84 52 98 27 42 8 11 83 67 66 57 81 80 47 95 53 98 66 88 60 0 93 98 43 87 47 17 48 49 28 35 28 \ No newline at end of file diff --git a/dozorova_alena_lab_2/FilesInput/First/21.txt b/dozorova_alena_lab_2/FilesInput/First/21.txt new file mode 100644 index 0000000..3cec464 --- /dev/null +++ b/dozorova_alena_lab_2/FilesInput/First/21.txt @@ -0,0 +1 @@ +60 70 16 18 71 67 22 71 54 55 70 57 13 54 84 73 99 27 53 13 49 68 12 89 96 77 93 52 80 62 59 11 73 9 33 40 49 82 1 \ No newline at end of file diff --git a/dozorova_alena_lab_2/FilesInput/First/22.txt b/dozorova_alena_lab_2/FilesInput/First/22.txt new file mode 100644 index 0000000..3ce9290 --- /dev/null +++ b/dozorova_alena_lab_2/FilesInput/First/22.txt @@ -0,0 +1 @@ +67 22 18 71 64 80 19 5 28 2 75 73 9 51 8 81 76 36 96 26 58 96 95 4 88 51 24 10 71 33 79 63 21 59 95 61 28 97 40 \ No newline at end of file diff --git a/dozorova_alena_lab_2/FilesInput/First/23.txt b/dozorova_alena_lab_2/FilesInput/First/23.txt new file mode 100644 index 0000000..279a9fd --- /dev/null +++ b/dozorova_alena_lab_2/FilesInput/First/23.txt @@ -0,0 +1 @@ +62 36 50 68 46 3 28 7 16 30 26 1 21 39 27 78 13 92 34 6 6 38 70 1 1 42 45 20 98 49 61 24 51 45 56 33 53 3 75 \ No newline at end of file diff --git a/dozorova_alena_lab_2/FilesInput/First/24.txt b/dozorova_alena_lab_2/FilesInput/First/24.txt new file mode 100644 index 0000000..c6b785a --- /dev/null +++ b/dozorova_alena_lab_2/FilesInput/First/24.txt @@ -0,0 +1 @@ +81 40 95 8 98 87 88 60 51 87 38 42 13 99 75 24 98 90 33 71 99 41 95 68 39 52 9 64 77 61 70 17 90 91 64 53 41 13 5 \ No newline at end of file diff --git a/dozorova_alena_lab_2/FilesInput/First/25.txt b/dozorova_alena_lab_2/FilesInput/First/25.txt new file mode 100644 index 0000000..574d4ec --- /dev/null +++ b/dozorova_alena_lab_2/FilesInput/First/25.txt @@ -0,0 +1 @@ +79 25 4 32 1 51 91 16 26 23 87 8 98 25 23 86 23 94 24 35 34 84 54 79 46 18 40 48 90 9 98 80 37 20 80 79 4 13 57 \ No newline at end of file diff --git a/dozorova_alena_lab_2/FilesInput/First/26.txt b/dozorova_alena_lab_2/FilesInput/First/26.txt new file mode 100644 index 0000000..8caa6bf --- /dev/null +++ b/dozorova_alena_lab_2/FilesInput/First/26.txt @@ -0,0 +1 @@ +66 95 69 29 36 5 17 70 97 10 6 72 92 87 72 90 68 94 77 49 23 68 73 74 77 49 94 75 40 52 57 70 80 77 67 34 67 65 61 \ No newline at end of file diff --git a/dozorova_alena_lab_2/FilesInput/First/27.txt b/dozorova_alena_lab_2/FilesInput/First/27.txt new file mode 100644 index 0000000..8e91577 --- /dev/null +++ b/dozorova_alena_lab_2/FilesInput/First/27.txt @@ -0,0 +1 @@ +21 5 57 27 17 89 4 91 80 49 55 57 92 9 61 37 92 33 28 18 27 45 88 7 61 26 22 64 24 17 63 70 75 1 69 96 62 77 47 \ No newline at end of file diff --git a/dozorova_alena_lab_2/FilesInput/First/28.txt b/dozorova_alena_lab_2/FilesInput/First/28.txt new file mode 100644 index 0000000..67c6f55 --- /dev/null +++ b/dozorova_alena_lab_2/FilesInput/First/28.txt @@ -0,0 +1 @@ +28 63 7 24 14 25 49 42 34 18 14 1 59 60 47 21 75 54 29 11 89 46 90 69 61 37 18 75 55 43 43 16 80 93 55 27 67 50 11 \ No newline at end of file diff --git a/dozorova_alena_lab_2/FilesInput/First/29.txt b/dozorova_alena_lab_2/FilesInput/First/29.txt new file mode 100644 index 0000000..a288228 --- /dev/null +++ b/dozorova_alena_lab_2/FilesInput/First/29.txt @@ -0,0 +1 @@ +35 9 60 57 42 99 29 73 61 44 21 75 18 96 67 9 81 37 39 54 83 33 62 62 17 30 11 7 30 10 37 1 36 75 92 40 77 37 69 \ No newline at end of file diff --git a/dozorova_alena_lab_2/FilesInput/First/3.txt b/dozorova_alena_lab_2/FilesInput/First/3.txt new file mode 100644 index 0000000..55fb352 --- /dev/null +++ b/dozorova_alena_lab_2/FilesInput/First/3.txt @@ -0,0 +1 @@ +10 26 86 88 31 39 62 76 84 21 83 62 10 0 70 87 46 67 31 19 40 17 68 18 57 87 63 58 21 90 31 74 30 76 4 25 47 77 88 \ No newline at end of file diff --git a/dozorova_alena_lab_2/FilesInput/First/30.txt b/dozorova_alena_lab_2/FilesInput/First/30.txt new file mode 100644 index 0000000..4c0df26 --- /dev/null +++ b/dozorova_alena_lab_2/FilesInput/First/30.txt @@ -0,0 +1 @@ +2 39 85 29 46 99 69 64 89 20 5 72 23 47 57 14 64 9 62 22 15 48 93 51 14 28 97 18 60 48 44 9 70 22 25 69 53 86 67 \ No newline at end of file diff --git a/dozorova_alena_lab_2/FilesInput/First/31.txt b/dozorova_alena_lab_2/FilesInput/First/31.txt new file mode 100644 index 0000000..1cdff86 --- /dev/null +++ b/dozorova_alena_lab_2/FilesInput/First/31.txt @@ -0,0 +1 @@ +21 39 28 1 2 38 90 22 23 47 88 51 84 55 44 20 74 48 66 82 9 37 39 5 30 24 53 33 25 1 83 69 61 80 68 30 55 49 61 \ No newline at end of file diff --git a/dozorova_alena_lab_2/FilesInput/First/32.txt b/dozorova_alena_lab_2/FilesInput/First/32.txt new file mode 100644 index 0000000..b77936c --- /dev/null +++ b/dozorova_alena_lab_2/FilesInput/First/32.txt @@ -0,0 +1 @@ +77 3 9 39 23 95 77 44 53 18 33 10 85 90 84 47 55 48 69 91 44 93 70 1 30 12 64 98 15 57 43 18 69 61 8 17 77 16 95 \ No newline at end of file diff --git a/dozorova_alena_lab_2/FilesInput/First/33.txt b/dozorova_alena_lab_2/FilesInput/First/33.txt new file mode 100644 index 0000000..fd1dc3e --- /dev/null +++ b/dozorova_alena_lab_2/FilesInput/First/33.txt @@ -0,0 +1 @@ +13 6 29 65 44 37 43 75 20 61 35 9 39 20 28 58 58 55 11 16 18 65 62 41 36 96 63 75 61 5 13 75 9 84 1 59 73 87 10 \ No newline at end of file diff --git a/dozorova_alena_lab_2/FilesInput/First/34.txt b/dozorova_alena_lab_2/FilesInput/First/34.txt new file mode 100644 index 0000000..a1efda9 --- /dev/null +++ b/dozorova_alena_lab_2/FilesInput/First/34.txt @@ -0,0 +1 @@ +57 35 36 64 48 37 9 72 89 61 83 89 29 6 13 25 11 41 33 21 68 58 74 63 54 48 16 49 53 1 70 93 3 87 9 34 69 77 95 \ No newline at end of file diff --git a/dozorova_alena_lab_2/FilesInput/First/35.txt b/dozorova_alena_lab_2/FilesInput/First/35.txt new file mode 100644 index 0000000..cbafe7e --- /dev/null +++ b/dozorova_alena_lab_2/FilesInput/First/35.txt @@ -0,0 +1 @@ +34 62 93 45 30 62 34 1 60 29 15 69 96 74 2 24 98 13 95 65 0 36 64 37 60 56 54 55 7 49 10 21 16 86 63 49 96 11 26 \ No newline at end of file diff --git a/dozorova_alena_lab_2/FilesInput/First/36.txt b/dozorova_alena_lab_2/FilesInput/First/36.txt new file mode 100644 index 0000000..1d2c8bd --- /dev/null +++ b/dozorova_alena_lab_2/FilesInput/First/36.txt @@ -0,0 +1 @@ +29 15 87 70 80 67 79 64 7 52 29 91 5 88 52 77 83 56 74 34 27 27 25 22 95 91 56 10 21 84 82 54 92 94 98 23 56 65 43 \ No newline at end of file diff --git a/dozorova_alena_lab_2/FilesInput/First/37.txt b/dozorova_alena_lab_2/FilesInput/First/37.txt new file mode 100644 index 0000000..6c47d53 --- /dev/null +++ b/dozorova_alena_lab_2/FilesInput/First/37.txt @@ -0,0 +1 @@ +87 41 82 29 38 22 89 69 3 92 55 73 0 30 70 20 71 96 98 38 60 26 62 21 34 0 10 99 71 31 83 40 56 25 40 16 21 48 17 \ No newline at end of file diff --git a/dozorova_alena_lab_2/FilesInput/First/38.txt b/dozorova_alena_lab_2/FilesInput/First/38.txt new file mode 100644 index 0000000..f9a19a7 --- /dev/null +++ b/dozorova_alena_lab_2/FilesInput/First/38.txt @@ -0,0 +1 @@ +69 78 36 30 6 95 39 12 30 63 57 84 83 8 25 50 64 96 84 1 99 85 67 48 72 93 93 90 99 74 58 39 15 66 3 11 72 87 70 \ No newline at end of file diff --git a/dozorova_alena_lab_2/FilesInput/First/4.txt b/dozorova_alena_lab_2/FilesInput/First/4.txt new file mode 100644 index 0000000..d21d0e5 --- /dev/null +++ b/dozorova_alena_lab_2/FilesInput/First/4.txt @@ -0,0 +1 @@ +88 14 19 72 87 34 86 83 13 68 37 54 93 97 67 68 3 8 37 24 22 52 98 83 64 88 0 89 46 7 78 78 26 45 14 10 91 45 35 \ No newline at end of file diff --git a/dozorova_alena_lab_2/FilesInput/First/5.txt b/dozorova_alena_lab_2/FilesInput/First/5.txt new file mode 100644 index 0000000..d099947 --- /dev/null +++ b/dozorova_alena_lab_2/FilesInput/First/5.txt @@ -0,0 +1 @@ +46 1 4 50 36 86 56 84 17 54 89 38 36 25 4 93 48 97 63 99 34 42 0 9 16 88 82 10 98 57 0 37 41 33 32 27 61 43 3 \ No newline at end of file diff --git a/dozorova_alena_lab_2/FilesInput/First/6.txt b/dozorova_alena_lab_2/FilesInput/First/6.txt new file mode 100644 index 0000000..87d0082 --- /dev/null +++ b/dozorova_alena_lab_2/FilesInput/First/6.txt @@ -0,0 +1 @@ +32 0 85 46 21 63 83 28 15 57 69 68 65 72 86 9 56 3 11 33 62 50 85 20 37 92 61 66 60 78 68 66 84 9 6 77 32 19 36 \ No newline at end of file diff --git a/dozorova_alena_lab_2/FilesInput/First/7.txt b/dozorova_alena_lab_2/FilesInput/First/7.txt new file mode 100644 index 0000000..a69e9f4 --- /dev/null +++ b/dozorova_alena_lab_2/FilesInput/First/7.txt @@ -0,0 +1 @@ +59 49 82 65 53 10 15 58 87 83 57 14 54 34 52 98 97 2 11 1 68 7 15 69 57 67 83 7 26 6 38 31 1 60 38 88 72 33 41 \ No newline at end of file diff --git a/dozorova_alena_lab_2/FilesInput/First/8.txt b/dozorova_alena_lab_2/FilesInput/First/8.txt new file mode 100644 index 0000000..b42b4f3 --- /dev/null +++ b/dozorova_alena_lab_2/FilesInput/First/8.txt @@ -0,0 +1 @@ +76 27 40 19 12 76 83 72 55 53 80 20 94 17 20 8 77 52 87 40 20 36 81 92 56 31 31 33 51 18 28 10 44 88 63 41 15 53 64 \ No newline at end of file diff --git a/dozorova_alena_lab_2/FilesInput/First/9.txt b/dozorova_alena_lab_2/FilesInput/First/9.txt new file mode 100644 index 0000000..cbc48b0 --- /dev/null +++ b/dozorova_alena_lab_2/FilesInput/First/9.txt @@ -0,0 +1 @@ +11 56 97 86 0 43 38 49 0 91 1 94 58 27 82 9 25 7 28 41 37 97 44 97 87 96 74 9 10 89 91 51 94 32 77 34 15 12 0 \ No newline at end of file diff --git a/dozorova_alena_lab_2/FilesInput/Second/data.txt b/dozorova_alena_lab_2/FilesInput/Second/data.txt new file mode 100644 index 0000000..85b45be --- /dev/null +++ b/dozorova_alena_lab_2/FilesInput/Second/data.txt @@ -0,0 +1 @@ +52 32 22 57 23 30 63 22 27 32 10 0 58 40 83 86 21 87 84 27 44 31 59 35 37 57 21 97 87 7 23 89 27 35 55 9 14 35 59 \ No newline at end of file diff --git a/dozorova_alena_lab_2/FilesOutput/result.txt b/dozorova_alena_lab_2/FilesOutput/result.txt new file mode 100644 index 0000000..5a0a33a --- /dev/null +++ b/dozorova_alena_lab_2/FilesOutput/result.txt @@ -0,0 +1 @@ +9409 \ No newline at end of file diff --git a/dozorova_alena_lab_2/docker-compose.yml b/dozorova_alena_lab_2/docker-compose.yml new file mode 100644 index 0000000..4e6538b --- /dev/null +++ b/dozorova_alena_lab_2/docker-compose.yml @@ -0,0 +1,14 @@ +services: + first: + build: ./ConsoleApp1/ + volumes: + - ./FilesInput/First:/var/data + - ./FilesInput/Second:/var/result + + second: + build: ./ConsoleApp2/ + depends_on: + - first + volumes: + - ./FilesInput/Second:/var/data + - ./FilesOutput:/var/result \ No newline at end of file diff --git a/dozorova_alena_lab_2/readme.md b/dozorova_alena_lab_2/readme.md new file mode 100644 index 0000000..736c1cc --- /dev/null +++ b/dozorova_alena_lab_2/readme.md @@ -0,0 +1,70 @@ +# Лабораторная работа 2 +В рамках лабораторной работы были реализованы два сервиса, для которых выходные данные первого являются входными данными второго. +## Описание +Варианты: +Первый сервис - 5 +Второй сервис - 1 +Оба сервиса являются консольным приложением с сгенерированным dockerfile +В результате были проброшены папки следующим образом: +для первого сервиса : +``` + volumes: + - ./FilesInput/First:/var/data + - ./FilesInput/Second:/var/result +``` +для второго сервиса: +``` + volumes: + - ./FilesInput/Second:/var/data + - ./FilesOutput:/var/result +``` +## Запуск +Для запуска лабораторной работы необходимо иметь запущенный Docker. +Из папки, где находится файл docker-compose.yml запустить консоль и выполнить: +``` +docker compose up --build +``` +Флаг `--build` указывает на то, что необходимо выполнить сборку исходников. +После сборки мы получим следующие логи: +[+] Running 3/2 + ✔ Network dozorova_alena_lab_2_default Created 0.2s + ✔ Container dozorova_alena_lab_2-first-1 Created 0.1s + ✔ Container dozorova_alena_lab_2-second-1 Created 0.0s +Attaching to first-1, second-1 +first-1 | Start first service +first-1 | Find file /var/data/0.txt +first-1 | Copy to /var/result/data.txt +first-1 exited with code 0 +second-1 | Start second service +second-1 | Find max value: 97 +second-1 | Save to /var/result/result.txt +second-1 exited with code 0 +## Пример dockerfile +``` +FROM mcr.microsoft.com/dotnet/runtime:6.0 AS base #базовый образ сборки +WORKDIR /app + +FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build #используем sdk для сборки +ARG BUILD_CONFIGURATION=Release #сборку проводим в релизной конфигурации +WORKDIR /src +COPY ["ConsoleApp2.csproj", "."] #копируем в контейнер +RUN dotnet restore "./ConsoleApp2.csproj" #восстанавливаем зависимости +COPY . . #копируем в папку сборки +WORKDIR "/src/." +RUN dotnet build "./ConsoleApp2.csproj" -c $BUILD_CONFIGURATION -o /app/build #собираем проект + +FROM build AS publish #все, что создалось в папке publish +ARG BUILD_CONFIGURATION=Release +RUN dotnet publish "./ConsoleApp2.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false #публикуем в /app/publish + +FROM base AS final #берем базовый образ +WORKDIR /app #указываем рабочую папку +COPY --from=publish /app/publish . #опубликованное копируем в app +ENTRYPOINT ["dotnet", "ConsoleApp2.dll"] #указываем команду запуска приложения +``` + +## Особенности compose файла +Директива`depends_on` позволяет указать, какого сервиса мы дожидаемся, прежде чем запустимся. +Директива `build` позволяет использовать не уже готовый образ, а тот, что будет собран непосредственно в момент запуска. +## Видеодемонстрация +Был записан видеоролик, демонстрирующий процесс запуска и работы сервисов. Он расположен по [адресу](https://drive.google.com/file/d/1BOt_Ja9AanINPjJyRKzgUaghRGwJYdd7/view?usp=drive_link) \ No newline at end of file