Compare commits
2 Commits
5b367121c4
...
8a18e71a6f
| Author | SHA1 | Date | |
|---|---|---|---|
| 8a18e71a6f | |||
| e49ec42f30 |
@@ -1,22 +1,24 @@
|
|||||||
#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.
|
#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/aspnet:8.0 AS base
|
FROM mcr.microsoft.com/dotnet/aspnet:8.0-alpine AS base
|
||||||
USER app
|
USER app
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
EXPOSE 8080
|
EXPOSE 8080
|
||||||
|
|
||||||
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
|
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:8.0-alpine AS build
|
||||||
ARG BUILD_CONFIGURATION=Release
|
ARG BUILD_CONFIGURATION=Release
|
||||||
|
ARG TARGETARCH
|
||||||
WORKDIR /src
|
WORKDIR /src
|
||||||
COPY ["AS1024.GeoFeed/AS1024.GeoFeed.csproj", "AS1024.GeoFeed/"]
|
COPY ["AS1024.GeoFeed/AS1024.GeoFeed.csproj", "AS1024.GeoFeed/"]
|
||||||
RUN dotnet restore "./AS1024.GeoFeed/./AS1024.GeoFeed.csproj"
|
RUN dotnet restore "./AS1024.GeoFeed/./AS1024.GeoFeed.csproj" -a $TARGETARCH
|
||||||
COPY . .
|
COPY . .
|
||||||
WORKDIR "/src/AS1024.GeoFeed"
|
WORKDIR "/src/AS1024.GeoFeed"
|
||||||
RUN dotnet build "./AS1024.GeoFeed.csproj" -c $BUILD_CONFIGURATION -o /app/build
|
RUN dotnet build "./AS1024.GeoFeed.csproj" -c $BUILD_CONFIGURATION -o /app/build -a $TARGETARCH
|
||||||
|
|
||||||
FROM build AS publish
|
FROM --platform=$BUILDPLATFORM build AS publish
|
||||||
ARG BUILD_CONFIGURATION=Release
|
ARG BUILD_CONFIGURATION=Release
|
||||||
RUN dotnet publish "./AS1024.GeoFeed.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false
|
ARG TARGETARCH
|
||||||
|
RUN dotnet publish "./AS1024.GeoFeed.csproj" -c $BUILD_CONFIGURATION -o /app/publish -a $TARGETARCH /p:UseAppHost=false
|
||||||
|
|
||||||
FROM base AS final
|
FROM base AS final
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|||||||
@@ -21,6 +21,17 @@ namespace AS1024.GeoFeed.GeoFeedBuilder
|
|||||||
}
|
}
|
||||||
|
|
||||||
async Task IHostedService.StartAsync(CancellationToken cancellationToken)
|
async Task IHostedService.StartAsync(CancellationToken cancellationToken)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
await StartPreLoad();
|
||||||
|
} catch (Exception ex)
|
||||||
|
{
|
||||||
|
logger.LogWarning($"Failed to preload, exception settings below:\n{ex}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task StartPreLoad()
|
||||||
{
|
{
|
||||||
logger.LogInformation("Preloading GeoFeed data in memory...");
|
logger.LogInformation("Preloading GeoFeed data in memory...");
|
||||||
List<Models.IPGeoFeed> feed = await provider.GetGeoFeedData();
|
List<Models.IPGeoFeed> feed = await provider.GetGeoFeedData();
|
||||||
|
|||||||
Reference in New Issue
Block a user