Skip to content

Commit

Permalink
Added Docker support
Browse files Browse the repository at this point in the history
  • Loading branch information
DamianMorozov committed Mar 27, 2024
1 parent c3a425e commit 5b416bc
Show file tree
Hide file tree
Showing 90 changed files with 1,730 additions and 618 deletions.
28 changes: 28 additions & 0 deletions Clients/TgDownloaderBlazor/App.razor.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// This is an independent project of an individual developer. Dear PVS-Studio, please check it.
// PVS-Studio Static Code Analyzer for C, C++, C#, and Java: http://www.viva64.com


namespace TgDownloaderBlazor;

public partial class App
{
private static bool IsCurrentDirSet { get; set; }

public App()
{
#if DEBUG
if (!IsCurrentDirSet)
{
IsCurrentDirSet = true;
string debugAnyCpu =
#if NET8_0
"bin\\Debug_AnyCPU\\net8.0";
#else
"bin\\Debug_AnyCPU";
#endif
if (!Environment.CurrentDirectory.Contains(debugAnyCpu) && Environment.Is64BitProcess)
Environment.CurrentDirectory = Path.Combine(Environment.CurrentDirectory, debugAnyCpu);
}
#endif
}
}
7 changes: 4 additions & 3 deletions Clients/TgDownloaderBlazor/Common/TgPageComponentBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,18 @@ public abstract class TgPageComponentBase : ComponentBase
{
#region Public and private fields, properties, constructor

[Inject] protected IJSRuntime JsRuntime { get; set; } = default!;
[Inject] protected NavigationManager UriHelper { get; set; } = default!;
[Inject] protected DialogService DialogService { get; set; } = default!;
[Inject] protected TooltipService TooltipService { get; set; } = default!;
[Inject] protected ContextMenuService ContextMenuService { get; set; } = default!;
[Inject] protected NotificationService NotificationService { get; set; } = default!;
[Inject] public IDbContextFactory<TgEfContext> DbFactory { get; set; } = default!;
[Inject] protected IDbContextFactory<TgEfContext> DbFactory { get; set; } = default!;
[Inject] protected TgJsService JsService { get; set; } = default!;

protected TgLocaleHelper TgLocale => TgLocaleHelper.Instance;
protected TgAppSettingsHelper AppSettings => TgAppSettingsHelper.Instance;
protected virtual bool IsLoading { get; set; } = true;
protected static TgClientHelper TgClient => TgClientHelper.Instance;
public bool IsBlazorLoading { get; set; } = true;

#endregion
}
31 changes: 11 additions & 20 deletions Clients/TgDownloaderBlazor/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,24 +1,15 @@
#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.

# Docker base image
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443

FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
ARG BUILD_CONFIGURATION=Release
WORKDIR /src
COPY ["Clients/TgDownloaderBlazor/TgDownloaderBlazor.csproj", "Clients/TgDownloaderBlazor/"]
RUN dotnet restore "./Clients/TgDownloaderBlazor/TgDownloaderBlazor.csproj"
COPY . .
WORKDIR "/src/Clients/TgDownloaderBlazor"
RUN dotnet build "./TgDownloaderBlazor.csproj" -c $BUILD_CONFIGURATION -o /app/build

FROM build AS publish
ARG BUILD_CONFIGURATION=Release
RUN dotnet publish "./TgDownloaderBlazor.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false

FROM base AS final
# Image setup
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "TgDownloaderBlazor.dll"]
EXPOSE 7682/tcp
ENV ASPNETCORE_URLS=http://0.0.0.0:7682
USER app

# App
COPY "/app" "/app"
ENTRYPOINT ["dotnet", "TgDownloaderBlazor.dll"]
63 changes: 0 additions & 63 deletions Clients/TgDownloaderBlazor/Features/Apps/AppComponent.razor

This file was deleted.

161 changes: 0 additions & 161 deletions Clients/TgDownloaderBlazor/Features/Apps/AppComponent.razor.cs

This file was deleted.

Loading

0 comments on commit 5b416bc

Please sign in to comment.