forked from Alexey/DAS_2024_1
Merge pull request 'dozorova_alena_lab_2' (#11) from dozorova_alena_lab_2 into main
Reviewed-on: Alexey/DAS_2024_1#11
This commit is contained in:
commit
477afb824d
9
.gitignore
vendored
Normal file
9
.gitignore
vendored
Normal file
@ -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
|
30
dozorova_alena_lab_2/ConsoleApp1/.dockerignore
Normal file
30
dozorova_alena_lab_2/ConsoleApp1/.dockerignore
Normal file
@ -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/**
|
13
dozorova_alena_lab_2/ConsoleApp1/ConsoleApp1.csproj
Normal file
13
dozorova_alena_lab_2/ConsoleApp1/ConsoleApp1.csproj
Normal file
@ -0,0 +1,13 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk;Microsoft.NET.Sdk.Publish">
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
|
||||
<DockerfileContext>.</DockerfileContext>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.20.1" />
|
||||
</ItemGroup>
|
||||
</Project>
|
7
dozorova_alena_lab_2/ConsoleApp1/ConsoleApp1.csproj.user
Normal file
7
dozorova_alena_lab_2/ConsoleApp1/ConsoleApp1.csproj.user
Normal file
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<ActiveDebugProfile>Container (Dockerfile)</ActiveDebugProfile>
|
||||
<_LastSelectedProfileId>C:\Users\Alena\WorkFolder\Study\politech\7\РВиП\DAS_2024_1\dozorova_alena_lab_2\ConsoleApp1\Properties\PublishProfiles\registry.hub.docker.com_alenadozorova.pubxml</_LastSelectedProfileId>
|
||||
</PropertyGroup>
|
||||
</Project>
|
25
dozorova_alena_lab_2/ConsoleApp1/ConsoleApp1.sln
Normal file
25
dozorova_alena_lab_2/ConsoleApp1/ConsoleApp1.sln
Normal file
@ -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
|
22
dozorova_alena_lab_2/ConsoleApp1/Dockerfile
Normal file
22
dozorova_alena_lab_2/ConsoleApp1/Dockerfile
Normal file
@ -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"]
|
32
dozorova_alena_lab_2/ConsoleApp1/Program.cs
Normal file
32
dozorova_alena_lab_2/ConsoleApp1/Program.cs
Normal file
@ -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");
|
||||
|
@ -0,0 +1,10 @@
|
||||
{
|
||||
"profiles": {
|
||||
"ConsoleApp1": {
|
||||
"commandName": "Project"
|
||||
},
|
||||
"Container (Dockerfile)": {
|
||||
"commandName": "Docker"
|
||||
}
|
||||
}
|
||||
}
|
30
dozorova_alena_lab_2/ConsoleApp2/.dockerignore
Normal file
30
dozorova_alena_lab_2/ConsoleApp2/.dockerignore
Normal file
@ -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/**
|
16
dozorova_alena_lab_2/ConsoleApp2/ConsoleApp2.csproj
Normal file
16
dozorova_alena_lab_2/ConsoleApp2/ConsoleApp2.csproj
Normal file
@ -0,0 +1,16 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
|
||||
<DockerfileContext>.</DockerfileContext>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.20.1" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
6
dozorova_alena_lab_2/ConsoleApp2/ConsoleApp2.csproj.user
Normal file
6
dozorova_alena_lab_2/ConsoleApp2/ConsoleApp2.csproj.user
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<ActiveDebugProfile>Container (Dockerfile)</ActiveDebugProfile>
|
||||
</PropertyGroup>
|
||||
</Project>
|
25
dozorova_alena_lab_2/ConsoleApp2/ConsoleApp2.sln
Normal file
25
dozorova_alena_lab_2/ConsoleApp2/ConsoleApp2.sln
Normal file
@ -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
|
22
dozorova_alena_lab_2/ConsoleApp2/Dockerfile
Normal file
22
dozorova_alena_lab_2/ConsoleApp2/Dockerfile
Normal file
@ -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"]
|
16
dozorova_alena_lab_2/ConsoleApp2/Program.cs
Normal file
16
dozorova_alena_lab_2/ConsoleApp2/Program.cs
Normal file
@ -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");
|
@ -0,0 +1,10 @@
|
||||
{
|
||||
"profiles": {
|
||||
"ConsoleApp2": {
|
||||
"commandName": "Project"
|
||||
},
|
||||
"Container (Dockerfile)": {
|
||||
"commandName": "Docker"
|
||||
}
|
||||
}
|
||||
}
|
1
dozorova_alena_lab_2/FilesInput/First/0.txt
Normal file
1
dozorova_alena_lab_2/FilesInput/First/0.txt
Normal file
@ -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
|
1
dozorova_alena_lab_2/FilesInput/First/1.txt
Normal file
1
dozorova_alena_lab_2/FilesInput/First/1.txt
Normal file
@ -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
|
1
dozorova_alena_lab_2/FilesInput/First/10.txt
Normal file
1
dozorova_alena_lab_2/FilesInput/First/10.txt
Normal file
@ -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
|
1
dozorova_alena_lab_2/FilesInput/First/11.txt
Normal file
1
dozorova_alena_lab_2/FilesInput/First/11.txt
Normal file
@ -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
|
1
dozorova_alena_lab_2/FilesInput/First/12.txt
Normal file
1
dozorova_alena_lab_2/FilesInput/First/12.txt
Normal file
@ -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
|
1
dozorova_alena_lab_2/FilesInput/First/13.txt
Normal file
1
dozorova_alena_lab_2/FilesInput/First/13.txt
Normal file
@ -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
|
1
dozorova_alena_lab_2/FilesInput/First/14.txt
Normal file
1
dozorova_alena_lab_2/FilesInput/First/14.txt
Normal file
@ -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
|
1
dozorova_alena_lab_2/FilesInput/First/15.txt
Normal file
1
dozorova_alena_lab_2/FilesInput/First/15.txt
Normal file
@ -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
|
1
dozorova_alena_lab_2/FilesInput/First/16.txt
Normal file
1
dozorova_alena_lab_2/FilesInput/First/16.txt
Normal file
@ -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
|
1
dozorova_alena_lab_2/FilesInput/First/17.txt
Normal file
1
dozorova_alena_lab_2/FilesInput/First/17.txt
Normal file
@ -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
|
1
dozorova_alena_lab_2/FilesInput/First/18.txt
Normal file
1
dozorova_alena_lab_2/FilesInput/First/18.txt
Normal file
@ -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
|
1
dozorova_alena_lab_2/FilesInput/First/19.txt
Normal file
1
dozorova_alena_lab_2/FilesInput/First/19.txt
Normal file
@ -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
|
1
dozorova_alena_lab_2/FilesInput/First/2.txt
Normal file
1
dozorova_alena_lab_2/FilesInput/First/2.txt
Normal file
@ -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
|
1
dozorova_alena_lab_2/FilesInput/First/20.txt
Normal file
1
dozorova_alena_lab_2/FilesInput/First/20.txt
Normal file
@ -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
|
1
dozorova_alena_lab_2/FilesInput/First/21.txt
Normal file
1
dozorova_alena_lab_2/FilesInput/First/21.txt
Normal file
@ -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
|
1
dozorova_alena_lab_2/FilesInput/First/22.txt
Normal file
1
dozorova_alena_lab_2/FilesInput/First/22.txt
Normal file
@ -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
|
1
dozorova_alena_lab_2/FilesInput/First/23.txt
Normal file
1
dozorova_alena_lab_2/FilesInput/First/23.txt
Normal file
@ -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
|
1
dozorova_alena_lab_2/FilesInput/First/24.txt
Normal file
1
dozorova_alena_lab_2/FilesInput/First/24.txt
Normal file
@ -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
|
1
dozorova_alena_lab_2/FilesInput/First/25.txt
Normal file
1
dozorova_alena_lab_2/FilesInput/First/25.txt
Normal file
@ -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
|
1
dozorova_alena_lab_2/FilesInput/First/26.txt
Normal file
1
dozorova_alena_lab_2/FilesInput/First/26.txt
Normal file
@ -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
|
1
dozorova_alena_lab_2/FilesInput/First/27.txt
Normal file
1
dozorova_alena_lab_2/FilesInput/First/27.txt
Normal file
@ -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
|
1
dozorova_alena_lab_2/FilesInput/First/28.txt
Normal file
1
dozorova_alena_lab_2/FilesInput/First/28.txt
Normal file
@ -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
|
1
dozorova_alena_lab_2/FilesInput/First/29.txt
Normal file
1
dozorova_alena_lab_2/FilesInput/First/29.txt
Normal file
@ -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
|
1
dozorova_alena_lab_2/FilesInput/First/3.txt
Normal file
1
dozorova_alena_lab_2/FilesInput/First/3.txt
Normal file
@ -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
|
1
dozorova_alena_lab_2/FilesInput/First/30.txt
Normal file
1
dozorova_alena_lab_2/FilesInput/First/30.txt
Normal file
@ -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
|
1
dozorova_alena_lab_2/FilesInput/First/31.txt
Normal file
1
dozorova_alena_lab_2/FilesInput/First/31.txt
Normal file
@ -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
|
1
dozorova_alena_lab_2/FilesInput/First/32.txt
Normal file
1
dozorova_alena_lab_2/FilesInput/First/32.txt
Normal file
@ -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
|
1
dozorova_alena_lab_2/FilesInput/First/33.txt
Normal file
1
dozorova_alena_lab_2/FilesInput/First/33.txt
Normal file
@ -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
|
1
dozorova_alena_lab_2/FilesInput/First/34.txt
Normal file
1
dozorova_alena_lab_2/FilesInput/First/34.txt
Normal file
@ -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
|
1
dozorova_alena_lab_2/FilesInput/First/35.txt
Normal file
1
dozorova_alena_lab_2/FilesInput/First/35.txt
Normal file
@ -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
|
1
dozorova_alena_lab_2/FilesInput/First/36.txt
Normal file
1
dozorova_alena_lab_2/FilesInput/First/36.txt
Normal file
@ -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
|
1
dozorova_alena_lab_2/FilesInput/First/37.txt
Normal file
1
dozorova_alena_lab_2/FilesInput/First/37.txt
Normal file
@ -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
|
1
dozorova_alena_lab_2/FilesInput/First/38.txt
Normal file
1
dozorova_alena_lab_2/FilesInput/First/38.txt
Normal file
@ -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
|
1
dozorova_alena_lab_2/FilesInput/First/4.txt
Normal file
1
dozorova_alena_lab_2/FilesInput/First/4.txt
Normal file
@ -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
|
1
dozorova_alena_lab_2/FilesInput/First/5.txt
Normal file
1
dozorova_alena_lab_2/FilesInput/First/5.txt
Normal file
@ -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
|
1
dozorova_alena_lab_2/FilesInput/First/6.txt
Normal file
1
dozorova_alena_lab_2/FilesInput/First/6.txt
Normal file
@ -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
|
1
dozorova_alena_lab_2/FilesInput/First/7.txt
Normal file
1
dozorova_alena_lab_2/FilesInput/First/7.txt
Normal file
@ -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
|
1
dozorova_alena_lab_2/FilesInput/First/8.txt
Normal file
1
dozorova_alena_lab_2/FilesInput/First/8.txt
Normal file
@ -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
|
1
dozorova_alena_lab_2/FilesInput/First/9.txt
Normal file
1
dozorova_alena_lab_2/FilesInput/First/9.txt
Normal file
@ -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
|
1
dozorova_alena_lab_2/FilesInput/Second/data.txt
Normal file
1
dozorova_alena_lab_2/FilesInput/Second/data.txt
Normal file
@ -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
|
1
dozorova_alena_lab_2/FilesOutput/result.txt
Normal file
1
dozorova_alena_lab_2/FilesOutput/result.txt
Normal file
@ -0,0 +1 @@
|
||||
9409
|
14
dozorova_alena_lab_2/docker-compose.yml
Normal file
14
dozorova_alena_lab_2/docker-compose.yml
Normal file
@ -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
|
70
dozorova_alena_lab_2/readme.md
Normal file
70
dozorova_alena_lab_2/readme.md
Normal file
@ -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)
|
Loading…
Reference in New Issue
Block a user