diff --git a/balakhonov_danila_lab_3/ApiRestaurant/.dockerignore b/balakhonov_danila_lab_3/ApiRestaurant/.dockerignore
new file mode 100644
index 0000000..fe1152b
--- /dev/null
+++ b/balakhonov_danila_lab_3/ApiRestaurant/.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/balakhonov_danila_lab_3/ApiRestaurant/ApiRestaurant.csproj b/balakhonov_danila_lab_3/ApiRestaurant/ApiRestaurant.csproj
index 2242827..0c43e46 100644
--- a/balakhonov_danila_lab_3/ApiRestaurant/ApiRestaurant.csproj
+++ b/balakhonov_danila_lab_3/ApiRestaurant/ApiRestaurant.csproj
@@ -4,10 +4,14 @@
net8.0
enable
enable
+ 9589d6f5-875c-4d7d-8e68-37a2077e80be
+ Linux
+ .
+
diff --git a/balakhonov_danila_lab_3/ApiRestaurant/ApiRestaurant.sln b/balakhonov_danila_lab_3/ApiRestaurant/ApiRestaurant.sln
new file mode 100644
index 0000000..caf1513
--- /dev/null
+++ b/balakhonov_danila_lab_3/ApiRestaurant/ApiRestaurant.sln
@@ -0,0 +1,25 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 17
+VisualStudioVersion = 17.11.35222.181
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ApiRestaurant", "ApiRestaurant.csproj", "{6E19ADDC-7351-4145-9C49-B0CC87BD1206}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {6E19ADDC-7351-4145-9C49-B0CC87BD1206}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {6E19ADDC-7351-4145-9C49-B0CC87BD1206}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {6E19ADDC-7351-4145-9C49-B0CC87BD1206}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {6E19ADDC-7351-4145-9C49-B0CC87BD1206}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {C62DE3C6-63AA-4075-9729-9F5ECD4E7B51}
+ EndGlobalSection
+EndGlobal
diff --git a/balakhonov_danila_lab_3/ApiRestaurant/Dockerfile b/balakhonov_danila_lab_3/ApiRestaurant/Dockerfile
index b11051a..5c1647c 100644
--- a/balakhonov_danila_lab_3/ApiRestaurant/Dockerfile
+++ b/balakhonov_danila_lab_3/ApiRestaurant/Dockerfile
@@ -1,15 +1,30 @@
+# См. статью по ссылке https://aka.ms/customizecontainer, чтобы узнать как настроить контейнер отладки и как Visual Studio использует этот Dockerfile для создания образов для ускорения отладки.
+
+# Этот этап используется при запуске из VS в быстром режиме (по умолчанию для конфигурации отладки)
+FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base
+USER app
+WORKDIR /app
+EXPOSE 8080
+EXPOSE 8081
+
+
+# Этот этап используется для сборки проекта службы
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
-WORKDIR /App
+ARG BUILD_CONFIGURATION=Release
+WORKDIR /src
+COPY ["ApiRestaurant.csproj", "."]
+RUN dotnet restore "./ApiRestaurant.csproj"
+COPY . .
+WORKDIR "/src/."
+RUN dotnet build "./ApiRestaurant.csproj" -c $BUILD_CONFIGURATION -o /app/build
-# Copy everything
-COPY . ./
-# Restore as distinct layers
-RUN dotnet restore
-# Build and publish a release
-RUN dotnet publish -c Release -o out
+# Этот этап используется для публикации проекта службы, который будет скопирован на последний этап
+FROM build AS publish
+ARG BUILD_CONFIGURATION=Release
+RUN dotnet publish "./ApiRestaurant.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false
-FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS app
-ENV ASPNETCORE_URLS=http://*:5089
-WORKDIR /App
-COPY --from=build /App/out .
+# Этот этап используется в рабочей среде или при запуске из VS в обычном режиме (по умолчанию, когда конфигурация отладки не используется)
+FROM base AS final
+WORKDIR /app
+COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "ApiRestaurant.dll"]
\ No newline at end of file
diff --git a/balakhonov_danila_lab_3/ApiRestaurant/Properties/launchSettings.json b/balakhonov_danila_lab_3/ApiRestaurant/Properties/launchSettings.json
index 4e89f9f..80deff5 100644
--- a/balakhonov_danila_lab_3/ApiRestaurant/Properties/launchSettings.json
+++ b/balakhonov_danila_lab_3/ApiRestaurant/Properties/launchSettings.json
@@ -1,33 +1,24 @@
-{
- "$schema": "http://json.schemastore.org/launchsettings.json",
- "iisSettings": {
- "windowsAuthentication": false,
- "anonymousAuthentication": true,
- "iisExpress": {
- "applicationUrl": "http://localhost:57319",
- "sslPort": 44369
- }
- },
+{
"profiles": {
"http": {
"commandName": "Project",
- "dotnetRunMessages": true,
"launchBrowser": true,
"launchUrl": "swagger",
- "applicationUrl": "http://localhost:5089",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
- }
+ },
+ "dotnetRunMessages": true,
+ "applicationUrl": "http://localhost:5089"
},
"https": {
"commandName": "Project",
- "dotnetRunMessages": true,
"launchBrowser": true,
"launchUrl": "swagger",
- "applicationUrl": "https://localhost:7269;http://localhost:5089",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
- }
+ },
+ "dotnetRunMessages": true,
+ "applicationUrl": "https://localhost:7269;http://localhost:5089"
},
"IIS Express": {
"commandName": "IISExpress",
@@ -36,6 +27,26 @@
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
+ },
+ "Container (Dockerfile)": {
+ "commandName": "Docker",
+ "launchBrowser": true,
+ "launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}/swagger",
+ "environmentVariables": {
+ "ASPNETCORE_HTTPS_PORTS": "8081",
+ "ASPNETCORE_HTTP_PORTS": "8080"
+ },
+ "publishAllPorts": true,
+ "useSSL": true
+ }
+ },
+ "$schema": "http://json.schemastore.org/launchsettings.json",
+ "iisSettings": {
+ "windowsAuthentication": false,
+ "anonymousAuthentication": true,
+ "iisExpress": {
+ "applicationUrl": "http://localhost:57319",
+ "sslPort": 44369
}
}
-}
+}
\ No newline at end of file