From 2b15a95e18ea23fdbf6d7926d10dba10538c1eaa Mon Sep 17 00:00:00 2001 From: Madpeter <57852827+Madpeterz@users.noreply.github.com> Date: Sun, 23 Jul 2023 15:19:27 +0100 Subject: [PATCH] working on getting docker going again --- .gitignore | 41 ++++---- BetterSecondBot.sln | 4 +- Dockerfile | 57 ----------- SecondBotEvents/Dockerfile | 86 +++++++++++++++++ SecondBotEvents/EventsSecondBot.cs | 2 +- .../Properties/launchSettings.json | 10 ++ SecondBotEvents/SecondBotEvents.csproj | 3 + SecondBotEvents/settings.env | 2 + oldDockerfile | 95 +++++++++++++++++++ 9 files changed, 221 insertions(+), 79 deletions(-) delete mode 100644 Dockerfile create mode 100644 SecondBotEvents/Dockerfile create mode 100644 SecondBotEvents/Properties/launchSettings.json create mode 100644 SecondBotEvents/settings.env create mode 100644 oldDockerfile diff --git a/.gitignore b/.gitignore index 68fe191..6e9a9fa 100644 --- a/.gitignore +++ b/.gitignore @@ -1,22 +1,23 @@ -compile.bat -*.user -*.userprefs -*.suo -*.cache -*.pfx -[Oo]bj/ -[Bb]in/ -packages/ -.idea/ -.vs/ -/Programs/examples/TestClient/Properties/launchSettings.json -.appveyor.yml -LICENSE.txt -mapgen.bat -PrimMesher/ -Programs/ -libremetaverse-core/.gitignore -BetterSecondbot/Dockerfile -BetterSecondbot/wiki/ +compile.bat +*.user +*.userprefs +*.suo +*.cache +*.pfx +[Oo]bj/ +[Bb]in/ +packages/ +.idea/ +.vs/ +/Programs/examples/TestClient/Properties/launchSettings.json +.appveyor.yml +LICENSE.txt +mapgen.bat +PrimMesher/ +Programs/ +libremetaverse-core/.gitignore +BetterSecondbot/Dockerfile +BetterSecondbot/wiki/ BetterSecondbot/debug.json BetterSecondbot/settings.env +SecondBotEvents/defaultBot/ diff --git a/BetterSecondBot.sln b/BetterSecondBot.sln index d8237ac..d3c0189 100644 --- a/BetterSecondBot.sln +++ b/BetterSecondBot.sln @@ -7,10 +7,12 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Secondbot", "Secondbot", "{ EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Project Items", "Project Items", "{C343303B-F9BF-46B3-BBB5-5596823EC71C}" ProjectSection(SolutionItems) = preProject + .dockerignore = .dockerignore .gitignore = .gitignore - Dockerfile = Dockerfile + SecondBotEvents\Dockerfile = SecondBotEvents\Dockerfile NuGet.Config = NuGet.Config README.md = README.md + oldDockerfile. = oldDockerfile. EndProjectSection EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SecondBotEvents", "SecondBotEvents\SecondBotEvents.csproj", "{571AB1AF-4C74-4C37-AC5B-9B63383AC791}" diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index 4def020..0000000 --- a/Dockerfile +++ /dev/null @@ -1,57 +0,0 @@ -#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging. - -FROM mcr.microsoft.com/dotnet/core/runtime:3.1-buster-slim AS base -WORKDIR /app - -FROM mcr.microsoft.com/dotnet/core/sdk:3.1-buster AS build -WORKDIR /src -COPY ["BetterSecondbot/BetterSecondbot.csproj", "BetterSecondbot/"] -COPY ["Core/Core.csproj", "Core/"] -COPY ["Shared/Shared.csproj", "Shared/"] -COPY ["LibreMetaverse/LibreMetaverse.csproj", "LibreMetaverse/"] -COPY ["LibreMetaverse.StructuredData/LibreMetaverse.StructuredData.csproj", "LibreMetaverse.StructuredData/"] -COPY ["LibreMetaverse.Types/LibreMetaverse.Types.csproj", "LibreMetaverse.Types/"] -RUN dotnet restore "BetterSecondbot/BetterSecondbot.csproj" -COPY . . -WORKDIR "/src/BetterSecondbot" -RUN dotnet build "BetterSecondbot.csproj" -c Release -o /app/build - -FROM build AS publish -RUN dotnet publish "BetterSecondbot.csproj" -c Release -o /app/publish - -FROM base AS final -WORKDIR /app -COPY --from=publish /app/publish . -# --- Update your settings --- - -ENV Basic_BotUserName='' \ - Basic_BotPassword='' \ - Basic_HomeRegions='Viserion/50/140/23' \ - Basic_AvoidRestartRegions='Just the Tip/60/96/1490' \ - Basic_LoginLocation='home' \ - Security_MasterUsername='' \ - Security_SubMasters='' \ - Security_SignedCommandkey='' \ - Security_WebUIKey='' \ - Setting_AllowFunds='false' \ - Setting_loginURI='secondlife' \ - Setting_Tracker='Event' \ - DiscordFull_Enable='false' \ - DiscordFull_Token='' \ - DiscordFull_ServerID='' \ - DiscordFull_Keep_GroupChat='false' \ - Http_Enable='false' \ - Http_Host='docker' \ - Log2File_Enable='false' \ - Log2File_Level='1' \ - Setting_LogCommands='false' \ - Agent_Channel='auto' \ - Agent_Version='auto' \ - OBJECT_CHAT='false' - -EXPOSE 80 -ENV ASPNETCORE_URLS http://+:80 - -# --- End of settings --- - -ENTRYPOINT ["/app/BetterSecondbot"] \ No newline at end of file diff --git a/SecondBotEvents/Dockerfile b/SecondBotEvents/Dockerfile new file mode 100644 index 0000000..265a34e --- /dev/null +++ b/SecondBotEvents/Dockerfile @@ -0,0 +1,86 @@ +#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/runtime:7.0 AS base +WORKDIR /app + +FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build +WORKDIR /src +COPY ["NuGet.Config", "."] +COPY ["SecondBotEvents/SecondBotEvents.csproj", "SecondBotEvents/"] +COPY ["LibreMetaverse/LibreMetaverse.csproj", "LibreMetaverse/"] +COPY ["LibreMetaverse.StructuredData/LibreMetaverse.StructuredData.csproj", "LibreMetaverse.StructuredData/"] +COPY ["LibreMetaverse.Types/LibreMetaverse.Types.csproj", "LibreMetaverse.Types/"] +RUN dotnet restore "SecondBotEvents/SecondBotEvents.csproj" +COPY . . +WORKDIR "/src/SecondBotEvents" +RUN dotnet build "SecondBotEvents.csproj" -c Release -o /app/build + +FROM build AS publish +RUN dotnet publish "SecondBotEvents.csproj" -c Release -o /app/publish /p:UseAppHost=false + +FROM base AS final +WORKDIR /app +COPY --from=publish /app/publish . + +ENV basic_Username = 'SecondbotR5' \ + basic_Password = '' \ + basic_LoginURI = 'secondlife' \ + commands_AllowFundsCommands = 'false' \ + commands_AllowIMcontrol = 'false' \ + commands_SharedSecret = 'examplecode' \ + commands_EnableMasterControls = 'true' \ + commands_MastersCSV = 'Madpeter Zond' \ + commands_EnforceTimeWindow = 'false' \ + commands_TimeWindowSecs = 35 \ + datastore_AutoCleanAvatars = 'true' \ + datastore_AvatarsCleanAfterMins = 10 \ + datastore_LocalChatHistoryLimit = 120 \ + datastore_GroupChatHistoryLimitPerGroup = 50 \ + datastore_ImChatHistoryLimit = 50 \ + datastore_PrefetchGroupMembers = 'true' \ + datastore_PrefetchGroupRoles = 'false' \ + datastore_PrefetchEstateBanlist = 'true' \ + datastore_AutoCleanKeyValueStore = 'true' \ + datastore_CleanKeyValueStoreAfterMins = 10 \ + datastore_CommandHistoryLimit = 30 \ + discord_Enabled = 'false' \ + discord_ServerID = '' \ + discord_ClientToken = '' \ + discord_AllowDiscordCommands = 'false' \ + events_Enabled = 'false' \ + events_GroupMemberJoins = 'false' \ + events_GroupMemberLeaves = 'false' \ + events_GroupMemberEventsGroupUUID = '' \ + events_GuestEntersArea = 'false' \ + events_GuestLeavesArea = 'false' \ + events_GuestTrackingSimname = '' \ + events_GuestTrackingParcelname = '' \ + events_SimAlertMessage = 'false' \ + events_StatusMessage = 'false' \ + events_MoneyEvent = 'false' \ + events_ChangeSim = 'false' \ + events_ChangeParcel = 'false' \ + events_OutputChannel = -1 \ + events_OutputIMuuid = '00000000-0000-0000-0000-000000000000' \ + events_OutputHttpURL = 'none' \ + events_OutputSecret = 'notset' \ + homebound_Enabled = 'false' \ + homebound_HomeSimSlUrl = '' \ + homebound_BackupSimSLUrl = '' \ + homebound_AtHomeSeekLocation = 'false' \ + homebound_AtBackupSeekLocation = 'false' \ + homebound_AtHomeAutoSitUuid = '00000000-0000-0000-0000-000000000000' \ + http_Enabled = 'false' \ + http_Port = 80 \ + Enabled = 'true' \ + AcceptTeleports = 'false' \ + AcceptGroupInvites = 'false' \ + AcceptInventory = 'false' \ + AcceptFriendRequests = 'false' \ + EnableJsonOutputEvents = 'false' \ + JsonOutputEventsTarget = 'none' + +EXPOSE 80 +ENV ASPNETCORE_URLS http://+:80 + +ENTRYPOINT ["dotnet", "SecondBotEvents.dll"] \ No newline at end of file diff --git a/SecondBotEvents/EventsSecondBot.cs b/SecondBotEvents/EventsSecondBot.cs index 96e827e..ea980c8 100644 --- a/SecondBotEvents/EventsSecondBot.cs +++ b/SecondBotEvents/EventsSecondBot.cs @@ -83,7 +83,7 @@ namespace SecondBotEvents protected bool exitNow = false; public EventsSecondBot(string[] args) { - if (SecondbotHelpers.notempty(Environment.GetEnvironmentVariable("basic_username")) == true) + if (SecondbotHelpers.notempty(Environment.GetEnvironmentVariable("basic_Username")) == true) { fromEnv = true; } diff --git a/SecondBotEvents/Properties/launchSettings.json b/SecondBotEvents/Properties/launchSettings.json new file mode 100644 index 0000000..f55bbae --- /dev/null +++ b/SecondBotEvents/Properties/launchSettings.json @@ -0,0 +1,10 @@ +{ + "profiles": { + "SecondBotEvents": { + "commandName": "Project" + }, + "Docker": { + "commandName": "Docker" + } + } +} \ No newline at end of file diff --git a/SecondBotEvents/SecondBotEvents.csproj b/SecondBotEvents/SecondBotEvents.csproj index 13fb8d0..97e0331 100644 --- a/SecondBotEvents/SecondBotEvents.csproj +++ b/SecondBotEvents/SecondBotEvents.csproj @@ -6,12 +6,15 @@ git rev-parse --short HEAD False False + Linux + settings.env + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/SecondBotEvents/settings.env b/SecondBotEvents/settings.env new file mode 100644 index 0000000..3a3cf51 --- /dev/null +++ b/SecondBotEvents/settings.env @@ -0,0 +1,2 @@ +basic_Username=SecondbotR5 +basic_Password= \ No newline at end of file diff --git a/oldDockerfile b/oldDockerfile new file mode 100644 index 0000000..2e87caa --- /dev/null +++ b/oldDockerfile @@ -0,0 +1,95 @@ +#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging. + +FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build +WORKDIR /src +COPY ["BetterSecondbot/BetterSecondbot.csproj", "BetterSecondbot/"] +COPY ["Core/Core.csproj", "Core/"] +COPY ["Shared/Shared.csproj", "Shared/"] +COPY ["LibreMetaverse/LibreMetaverse.csproj", "LibreMetaverse/"] +COPY ["LibreMetaverse.StructuredData/LibreMetaverse.StructuredData.csproj", "LibreMetaverse.StructuredData/"] +COPY ["LibreMetaverse.Types/LibreMetaverse.Types.csproj", "LibreMetaverse.Types/"] +RUN dotnet restore "BetterSecondbot/BetterSecondbot.csproj" +COPY . . +WORKDIR "/src/BetterSecondbot" +RUN dotnet publish "BetterSecondbot.csproj" -c Release -o /app/publish + +FROM mcr.microsoft.com/dotnet/runtime:7.0 +WORKDIR /app +COPY --from=publish /app/publish . +# --- Update your settings --- + +ENV + #-- basic + basic_Username = '' \ + basic_Password = '' \ + basic_LoginURI = 'secondlife' \ + #-- commands + commands_AllowFundsCommands = 'false' \ + commands_AllowIMcontrol = 'false' \ + commands_SharedSecret = 'examplecode' \ + commands_EnableMasterControls = 'true' \ + commands_MastersCSV = 'Madpeter Zond' \ + commands_EnforceTimeWindow = 'false' \ + commands_TimeWindowSecs = 35 \ + #-- datastore + datastore_AutoCleanAvatars = 'true' \ + datastore_AvatarsCleanAfterMins = 10 \ + datastore_LocalChatHistoryLimit = 120 \ + datastore_GroupChatHistoryLimitPerGroup = 50 \ + datastore_ImChatHistoryLimit = 50 \ + datastore_PrefetchGroupMembers = 'true' \ + datastore_PrefetchGroupRoles = 'false' \ + datastore_PrefetchEstateBanlist = 'true' \ + datastore_AutoCleanKeyValueStore = 'true' \ + datastore_CleanKeyValueStoreAfterMins = 10 \ + datastore_CommandHistoryLimit = 30 \ + #-- discord + discord_Enabled = 'false' \ + discord_ServerID = '' \ + discord_ClientToken = '' \ + discord_AllowDiscordCommands = 'false' \ + #-- events + events_Enabled = 'false' \ + events_GroupMemberJoins = 'false' \ + events_GroupMemberLeaves = 'false' \ + events_GroupMemberEventsGroupUUID = '' \ + events_GuestEntersArea = 'false' \ + events_GuestLeavesArea = 'false' \ + events_GuestTrackingSimname = '' \ + events_GuestTrackingParcelname = '' \ + events_SimAlertMessage = 'false' \ + events_StatusMessage = 'false' \ + events_MoneyEvent = 'false' \ + events_ChangeSim = 'false' \ + events_ChangeParcel = 'false' \ + events_OutputChannel = -1 \ + events_OutputIMuuid = '00000000-0000-0000-0000-000000000000' \ + events_OutputHttpURL = 'none' \ + events_OutputSecret = 'notset' \ + #-- homebound + homebound_Enabled = 'false' \ + homebound_HomeSimSlUrl = '' \ + homebound_BackupSimSLUrl = '' \ + homebound_AtHomeSeekLocation = 'false' \ + homebound_AtBackupSeekLocation = 'false' \ + homebound_AtHomeAutoSitUuid = '00000000-0000-0000-0000-000000000000' \ + #-- http + http_Enabled = 'false' \ + http_Port = 80 \ + #-- interactions + Enabled = 'true' \ + AcceptTeleports = 'false' \ + AcceptGroupInvites = 'false' \ + AcceptInventory = 'false' \ + AcceptFriendRequests = 'false' \ + EnableJsonOutputEvents = 'false' \ + JsonOutputEventsTarget = 'none' + + + +EXPOSE 80 +ENV ASPNETCORE_URLS http://+:80 + +# --- End of settings --- + +ENTRYPOINT ["/app/BetterSecondbot"] \ No newline at end of file