From 965924ea194a726f79e9279d88b4cca96c1e2089 Mon Sep 17 00:00:00 2001
From: Elias Stepanik <40958815+eliasstepanik@users.noreply.github.com>
Date: Wed, 31 May 2023 22:25:44 +0200
Subject: [PATCH 1/4] d
---
Functions/Dockerfile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Functions/Dockerfile b/Functions/Dockerfile
index b36ee4a..80cf58d 100644
--- a/Functions/Dockerfile
+++ b/Functions/Dockerfile
@@ -9,7 +9,7 @@ COPY ["Functions/Functions.csproj", "Functions/"]
RUN dotnet restore "Functions/Functions.csproj"
COPY . .
WORKDIR "/src/Functions"
-RUN dotnet build "Functions.csproj" -c Release -o /app/build
+RUN dotnet build "Functions.csproj" -c Release -o /app/build --build-arg source=src
FROM build AS publish
RUN dotnet publish "Functions.csproj" -c Release -o /app/publish /p:UseAppHost=false
From 8ef446192a83be5d4e3e5022e715849ed237c6ac Mon Sep 17 00:00:00 2001
From: Elias Stepanik <40958815+eliasstepanik@users.noreply.github.com>
Date: Wed, 31 May 2023 22:30:08 +0200
Subject: [PATCH 2/4] d
---
Functions/Dockerfile | 2 +-
Functions/Functions.csproj | 6 +++---
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/Functions/Dockerfile b/Functions/Dockerfile
index 80cf58d..b36ee4a 100644
--- a/Functions/Dockerfile
+++ b/Functions/Dockerfile
@@ -9,7 +9,7 @@ COPY ["Functions/Functions.csproj", "Functions/"]
RUN dotnet restore "Functions/Functions.csproj"
COPY . .
WORKDIR "/src/Functions"
-RUN dotnet build "Functions.csproj" -c Release -o /app/build --build-arg source=src
+RUN dotnet build "Functions.csproj" -c Release -o /app/build
FROM build AS publish
RUN dotnet publish "Functions.csproj" -c Release -o /app/publish /p:UseAppHost=false
diff --git a/Functions/Functions.csproj b/Functions/Functions.csproj
index 778170a..a3fcbc8 100644
--- a/Functions/Functions.csproj
+++ b/Functions/Functions.csproj
@@ -19,15 +19,15 @@
-
- .dockerignore
-
appsettings.json
appsettings.json
+
+ .dockerignore
+
From ae1902f4fb8ce40c7b1776ee25a29983e57fcf74 Mon Sep 17 00:00:00 2001
From: Elias Stepanik <40958815+eliasstepanik@users.noreply.github.com>
Date: Wed, 31 May 2023 22:37:41 +0200
Subject: [PATCH 3/4] d
---
docker-compose.yml | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/docker-compose.yml b/docker-compose.yml
index 0728a9e..dd201e4 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -8,7 +8,9 @@ networks:
services:
functions: #Name can not be changed
- build: ./Functions
+ build:
+ context: Functions
+ dockerfile: Dockerfile
environment:
DB_SERVER: "db"
DB_USER: "root"
From 90ee6e7cf5995c491c6b42a08967880c8ee3058f Mon Sep 17 00:00:00 2001
From: Elias Stepanik <40958815+eliasstepanik@users.noreply.github.com>
Date: Fri, 2 Jun 2023 17:23:01 +0200
Subject: [PATCH 4/4] Fixed Dockerfiles
---
Functions/Dockerfile | 33 ++++++--
TestFunction/Controllers/TestController.cs | 78 +++++++++++++++++++
.../Controllers/WeatherForecastController.cs | 32 --------
TestFunction/Dockerfile | 33 ++++++--
4 files changed, 130 insertions(+), 46 deletions(-)
create mode 100644 TestFunction/Controllers/TestController.cs
delete mode 100644 TestFunction/Controllers/WeatherForecastController.cs
diff --git a/Functions/Dockerfile b/Functions/Dockerfile
index b36ee4a..044bf83 100644
--- a/Functions/Dockerfile
+++ b/Functions/Dockerfile
@@ -1,18 +1,37 @@
-FROM mcr.microsoft.com/dotnet/aspnet:7.0 AS base
+#FROM mcr.microsoft.com/dotnet/aspnet:7.0 AS base
+#WORKDIR /app
+#EXPOSE 80
+#EXPOSE 443
+#
+#FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build
+#WORKDIR /src
+#COPY ["Functions/Functions.csproj", "Functions/"]
+#RUN dotnet restore "Functions/Functions.csproj"
+#COPY . .
+#WORKDIR "/src/Functions"
+#RUN dotnet build "Functions.csproj" -c Release -o /app/build
+#
+#FROM build AS publish
+#RUN dotnet publish "Functions.csproj" -c Release -o /app/publish /p:UseAppHost=false
+#
+#FROM base AS final
+#WORKDIR /app
+#COPY --from=publish /app/publish .
+#ENTRYPOINT ["dotnet", "Functions.dll"]
+
+FROM mcr.microsoft.com/dotnet/aspnet:7.0 AS base
WORKDIR /app
EXPOSE 80
-EXPOSE 443
FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build
WORKDIR /src
-COPY ["Functions/Functions.csproj", "Functions/"]
-RUN dotnet restore "Functions/Functions.csproj"
+COPY ["Functions.csproj", "./"]
+RUN dotnet restore "./Functions.csproj"
COPY . .
-WORKDIR "/src/Functions"
+WORKDIR "/src/."
RUN dotnet build "Functions.csproj" -c Release -o /app/build
-
FROM build AS publish
-RUN dotnet publish "Functions.csproj" -c Release -o /app/publish /p:UseAppHost=false
+RUN dotnet publish "Functions.csproj" -c Release -o /app/publish
FROM base AS final
WORKDIR /app
diff --git a/TestFunction/Controllers/TestController.cs b/TestFunction/Controllers/TestController.cs
new file mode 100644
index 0000000..ed1165e
--- /dev/null
+++ b/TestFunction/Controllers/TestController.cs
@@ -0,0 +1,78 @@
+using Microsoft.AspNetCore.Mvc;
+
+namespace TestFunction.Controllers;
+
+[ApiController]
+[Route("")]
+public class TestController : ControllerBase
+{
+ private static readonly string[] Summaries = new[]
+ {
+ "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
+ };
+
+ private readonly ILogger _logger;
+
+ public TestController(ILogger logger)
+ {
+ _logger = logger;
+ }
+
+ [HttpGet]
+ public IEnumerable Get()
+ {
+ return Enumerable.Range(1, 5).Select(index => new WeatherForecast
+ {
+ Date = DateOnly.FromDateTime(DateTime.Now.AddDays(index)),
+ TemperatureC = Random.Shared.Next(-20, 55),
+ Summary = Summaries[Random.Shared.Next(Summaries.Length)]
+ })
+ .ToArray();
+ }
+
+ [HttpPost]
+ public IEnumerable Post()
+ {
+ return Enumerable.Range(1, 5).Select(index => new WeatherForecast
+ {
+ Date = DateOnly.FromDateTime(DateTime.Now.AddDays(index)),
+ TemperatureC = Random.Shared.Next(-20, 55),
+ Summary = Summaries[Random.Shared.Next(Summaries.Length)]
+ })
+ .ToArray();
+ }
+
+ [HttpPatch]
+ public IEnumerable Patch()
+ {
+ return Enumerable.Range(1, 5).Select(index => new WeatherForecast
+ {
+ Date = DateOnly.FromDateTime(DateTime.Now.AddDays(index)),
+ TemperatureC = Random.Shared.Next(-20, 55),
+ Summary = Summaries[Random.Shared.Next(Summaries.Length)]
+ })
+ .ToArray();
+ }
+ [HttpDelete]
+ public IEnumerable Delete()
+ {
+ return Enumerable.Range(1, 5).Select(index => new WeatherForecast
+ {
+ Date = DateOnly.FromDateTime(DateTime.Now.AddDays(index)),
+ TemperatureC = Random.Shared.Next(-20, 55),
+ Summary = Summaries[Random.Shared.Next(Summaries.Length)]
+ })
+ .ToArray();
+ }
+ [HttpPut]
+ public IEnumerable Put()
+ {
+ return Enumerable.Range(1, 5).Select(index => new WeatherForecast
+ {
+ Date = DateOnly.FromDateTime(DateTime.Now.AddDays(index)),
+ TemperatureC = Random.Shared.Next(-20, 55),
+ Summary = Summaries[Random.Shared.Next(Summaries.Length)]
+ })
+ .ToArray();
+ }
+}
\ No newline at end of file
diff --git a/TestFunction/Controllers/WeatherForecastController.cs b/TestFunction/Controllers/WeatherForecastController.cs
deleted file mode 100644
index 500def6..0000000
--- a/TestFunction/Controllers/WeatherForecastController.cs
+++ /dev/null
@@ -1,32 +0,0 @@
-using Microsoft.AspNetCore.Mvc;
-
-namespace TestFunction.Controllers;
-
-[ApiController]
-[Route("")]
-public class WeatherForecastController : ControllerBase
-{
- private static readonly string[] Summaries = new[]
- {
- "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
- };
-
- private readonly ILogger _logger;
-
- public WeatherForecastController(ILogger logger)
- {
- _logger = logger;
- }
-
- [HttpGet(Name = "GetWeatherForecast")]
- public IEnumerable Get()
- {
- return Enumerable.Range(1, 5).Select(index => new WeatherForecast
- {
- Date = DateOnly.FromDateTime(DateTime.Now.AddDays(index)),
- TemperatureC = Random.Shared.Next(-20, 55),
- Summary = Summaries[Random.Shared.Next(Summaries.Length)]
- })
- .ToArray();
- }
-}
\ No newline at end of file
diff --git a/TestFunction/Dockerfile b/TestFunction/Dockerfile
index 29a8891..660e34d 100644
--- a/TestFunction/Dockerfile
+++ b/TestFunction/Dockerfile
@@ -1,18 +1,37 @@
-FROM mcr.microsoft.com/dotnet/aspnet:7.0 AS base
+#FROM mcr.microsoft.com/dotnet/aspnet:7.0 AS base
+#WORKDIR /app
+#EXPOSE 80
+#EXPOSE 443
+#
+#FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build
+#WORKDIR /src
+#COPY ["TestFunction.csproj", "TestFunction/"]
+#RUN dotnet restore "TestFunction/TestFunction.csproj"
+#COPY . .
+#WORKDIR "/src/TestFunction"
+#RUN dotnet build "TestFunction.csproj" -c Release -o /app/build
+#
+#FROM build AS publish
+#RUN dotnet publish "TestFunction.csproj" -c Release -o /app/publish /p:UseAppHost=false
+#
+#FROM base AS final
+#WORKDIR /app
+#COPY --from=publish /app/publish .
+#ENTRYPOINT ["dotnet", "TestFunction.dll"]
+
+FROM mcr.microsoft.com/dotnet/aspnet:7.0 AS base
WORKDIR /app
EXPOSE 80
-EXPOSE 443
FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build
WORKDIR /src
-COPY ["TestFunction/TestFunction.csproj", "TestFunction/"]
-RUN dotnet restore "TestFunction/TestFunction.csproj"
+COPY ["TestFunction.csproj", "./"]
+RUN dotnet restore "./TestFunction.csproj"
COPY . .
-WORKDIR "/src/TestFunction"
+WORKDIR "/src/."
RUN dotnet build "TestFunction.csproj" -c Release -o /app/build
-
FROM build AS publish
-RUN dotnet publish "TestFunction.csproj" -c Release -o /app/publish /p:UseAppHost=false
+RUN dotnet publish "TestFunction.csproj" -c Release -o /app/publish
FROM base AS final
WORKDIR /app