mirror of
https://github.com/eliasstepanik/SimpleFunctions.git
synced 2026-01-11 13:48:29 +00:00
Fixed Dockerfiles
This commit is contained in:
parent
ae1902f4fb
commit
90ee6e7cf5
@ -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
|
||||
|
||||
78
TestFunction/Controllers/TestController.cs
Normal file
78
TestFunction/Controllers/TestController.cs
Normal file
@ -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<TestController> _logger;
|
||||
|
||||
public TestController(ILogger<TestController> logger)
|
||||
{
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public IEnumerable<WeatherForecast> 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<WeatherForecast> 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<WeatherForecast> 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<WeatherForecast> 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<WeatherForecast> 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();
|
||||
}
|
||||
}
|
||||
@ -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<WeatherForecastController> _logger;
|
||||
|
||||
public WeatherForecastController(ILogger<WeatherForecastController> logger)
|
||||
{
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
[HttpGet(Name = "GetWeatherForecast")]
|
||||
public IEnumerable<WeatherForecast> 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();
|
||||
}
|
||||
}
|
||||
@ -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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user