Required push

This commit is contained in:
Álvaro Gómez Cuenca 2020-12-28 21:25:12 +01:00
commit a3c9481f3f
74 changed files with 2388 additions and 9 deletions

View file

@ -27,14 +27,12 @@ namespace Bot_Discord_CSharp
{ {
token = Environment.GetEnvironmentVariable("TOKEN"); token = Environment.GetEnvironmentVariable("TOKEN");
prefix = Environment.GetEnvironmentVariable("PREFIX"); prefix = Environment.GetEnvironmentVariable("PREFIX");
Console.WriteLine(0);
} else } else
{ {
ProfilesDto profiles = JsonConvert.DeserializeObject<ProfilesDto>(System.IO.File.ReadAllText("./launchSettings.json")); ProfilesDto profiles = JsonConvert.DeserializeObject<ProfilesDto>(System.IO.File.ReadAllText("./launchSettings.json"));
SecretsDto secrets = profiles.Bot_Discord_CSharp.EnvironmentVariables.Secrets; SecretsDto secrets = profiles.Bot_Discord_CSharp.EnvironmentVariables.Secrets;
token = secrets.Token; token = secrets.Token;
prefix = secrets.Prefix; prefix = secrets.Prefix;
Console.WriteLine(System.IO.File.ReadAllText("./launchSettings.json"));
} }
var config = new DiscordConfiguration var config = new DiscordConfiguration

View file

@ -1,8 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<OutputType>Exe</OutputType> <OutputType>exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework> <TargetFramework>netcoreapp3.1</TargetFramework>
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
<StartupObject>Bot_Discord_CSharp.Program</StartupObject>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
@ -18,6 +20,12 @@
<Folder Include="Properties\" /> <Folder Include="Properties\" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<None Update="Properties\launchSettings.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<ProjectExtensions><VisualStudio><UserProperties /></VisualStudio></ProjectExtensions> <ProjectExtensions><VisualStudio><UserProperties /></VisualStudio></ProjectExtensions>
</Project> </Project>

View file

@ -2,17 +2,23 @@
WORKDIR /app WORKDIR /app
# Copy csproj and restore as distinct layers # Copy csproj and restore as distinct layers
COPY *.csproj ./ COPY *.sln .
COPY Bot_Discord_CSharp/*.csproj ./aspnetapp/
#COPY *.csproj ./
RUN dotnet restore RUN dotnet restore
# Copy everything else and build # Copy everything else and build
COPY . ./ COPY Bot_Discord_CSharp/. ./aspnetapp/
WORKDIR /app/aspnetapp
#COPY . ./
RUN dotnet publish -c Release -o out RUN dotnet publish -c Release -o out
# Build runtime image # Build runtime image
FROM mcr.microsoft.com/dotnet/core/aspnet:3.1 FROM mcr.microsoft.com/dotnet/core/aspnet:3.1 as runtime
WORKDIR /app WORKDIR /app
COPY --from=build-env /app/out . COPY --from=build /app/aspnetapp/out ./
#COPY --from=build-env /app/out .
#COPY config.json ./ #COPY config.json ./
COPY Properties/launchSettings.json ./ COPY Properties/launchSettings.json ./

View file

@ -0,0 +1,6 @@
heroku container:login
docker build -t discord-bot-dsharp "E:\Proyectos Visual Studio\Bot_Discord_CSharp\Bot_Discord_CSharp\bin\Release\netcoreapp3.1\publish"
docker tag discord-bot-dsharp registry.heroku.com/discord-bot-dsharp/worker
docker push registry.heroku.com/discord-bot-dsharp/worker
heroku container:release worker --app discord-bot-dsharp
heroku container:push release --app discord-bot-dsharp

View file

@ -1,8 +1,8 @@
namespace Bot_Discord_CSharp namespace Bot_Discord_CSharp
{ {
class Program public class Program
{ {
static void Main(string[] args) public static void Main(string[] args)
{ {
Bot bot = new Bot(); Bot bot = new Bot();
bot.RunAsync().GetAwaiter().GetResult(); bot.RunAsync().GetAwaiter().GetResult();

26
Dockerfile Normal file
View file

@ -0,0 +1,26 @@
FROM mcr.microsoft.com/dotnet/core/sdk:3.1 AS build-env
WORKDIR /app
# Copy csproj and restore as distinct layers
COPY *.sln .
COPY Bot_Discord_CSharp/*.csproj ./aspnetapp/
#COPY *.csproj ./
RUN dotnet restore
# Copy everything else and build
COPY Bot_Discord_CSharp/. ./aspnetapp/
WORKDIR /app/aspnetapp
#COPY . ./
RUN dotnet publish -c Release -o out
# Build runtime image
FROM mcr.microsoft.com/dotnet/core/aspnet:3.1 as runtime
WORKDIR /app
COPY --from=build /app/aspnetapp/out ./
#COPY --from=build-env /app/out .
#COPY config.json ./
COPY Properties/launchSettings.json ./
ENTRYPOINT ["dotnet", "Bot_Discord_CSharp.dll"]

File diff suppressed because it is too large Load diff

BIN
app/Bot_Discord_CSharp.dll Normal file

Binary file not shown.

BIN
app/Bot_Discord_CSharp.exe Normal file

Binary file not shown.

View file

@ -0,0 +1,9 @@
{
"runtimeOptions": {
"tfm": "netcoreapp3.1",
"framework": {
"name": "Microsoft.NETCore.App",
"version": "3.1.0"
}
}
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
app/DSharpPlus.dll Normal file

Binary file not shown.

28
app/Dockerfile Normal file
View file

@ -0,0 +1,28 @@
FROM mcr.microsoft.com/dotnet/core/sdk:3.1 AS build-env
WORKDIR /app
# Copy csproj and restore as distinct layers
COPY *.sln .
WORKDIR /.
COPY Bot_Discord_CSharp/*.csproj ./aspnetapp/
WORKDIR /app
#COPY *.csproj ./
RUN dotnet restore
# Copy everything else and build
COPY Bot_Discord_CSharp/. ./aspnetapp/
WORKDIR /app/aspnetapp
#COPY . ./
RUN dotnet publish -c Release -o out
# Build runtime image
FROM mcr.microsoft.com/dotnet/core/aspnet:3.1 as runtime
WORKDIR /app
COPY --from=build /app/aspnetapp/out ./
#COPY --from=build-env /app/out .
#COPY config.json ./
COPY Properties/launchSettings.json ./
ENTRYPOINT ["dotnet", "Bot_Discord_CSharp.dll"]

BIN
app/Emzi0767.Common.dll Normal file

Binary file not shown.

BIN
app/HtmlAgilityPack.dll Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
app/Newtonsoft.Json.dll Normal file

Binary file not shown.

BIN
app/System.IO.Pipelines.dll Normal file

Binary file not shown.

Binary file not shown.

8
app/docker-compose.yml Normal file
View file

@ -0,0 +1,8 @@
version: "3"
services:
bot:
build: .
image: mydiscordbot

8
docker-compose.yml Normal file
View file

@ -0,0 +1,8 @@
version: "3"
services:
bot:
build: .
image: mydiscordbot