diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..2d15e48 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,20 @@ +**/.dockerignore +**/.env +**/.git +**/.gitignore +**/.vs +**/.vscode +**/*.*proj.user +**/azds.yaml +**/charts +**/bin +**/obj +**/Dockerfile +**/Dockerfile.develop +**/docker-compose.yml +**/docker-compose.*.yml +**/*.dbmdl +**/*.jfm +**/secrets.dev.yaml +**/values.dev.yaml +**/.toolstarget \ No newline at end of file diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..21cbd3b --- /dev/null +++ b/.travis.yml @@ -0,0 +1,10 @@ +language: csharp +mono: none +dist: xenial +dotnet: 2.2 + +install: +- dotnet restore + +script: + - dotnet build \ No newline at end of file diff --git a/EventBot/Dockerfile b/EventBot/Dockerfile new file mode 100644 index 0000000..d67b7e4 --- /dev/null +++ b/EventBot/Dockerfile @@ -0,0 +1,18 @@ +FROM mcr.microsoft.com/dotnet/core/runtime:2.2-stretch-slim AS base +WORKDIR /app + +FROM mcr.microsoft.com/dotnet/core/sdk:2.2-stretch AS build +WORKDIR /src +COPY ["EventBot/EventBot.csproj", "EventBot/"] +RUN dotnet restore "EventBot/EventBot.csproj" +COPY . . +WORKDIR "/src/EventBot" +RUN dotnet build "EventBot.csproj" -c Release -o /app + +FROM build AS publish +RUN dotnet publish "EventBot.csproj" -c Release -o /app + +FROM base AS final +WORKDIR /app +COPY --from=publish /app . +ENTRYPOINT ["dotnet", "EventBot.dll"] \ No newline at end of file diff --git a/EventBot/EventBot.csproj b/EventBot/EventBot.csproj index 25ce4df..67da6ae 100644 --- a/EventBot/EventBot.csproj +++ b/EventBot/EventBot.csproj @@ -3,12 +3,9 @@ Exe netcoreapp2.2 + Linux - - - - @@ -20,6 +17,7 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/EventBot/Properties/PublishProfiles/FolderProfile-linux-arm.pubxml b/EventBot/Properties/PublishProfiles/FolderProfile-linux-arm.pubxml new file mode 100644 index 0000000..3fc0995 --- /dev/null +++ b/EventBot/Properties/PublishProfiles/FolderProfile-linux-arm.pubxml @@ -0,0 +1,16 @@ + + + + + FileSystem + Release + Any CPU + netcoreapp2.2 + bin\Release\netcoreapp2.2\publish\linux-arm + linux-arm + true + <_IsPortable>false + + \ No newline at end of file diff --git a/EventBot/Properties/launchSettings.json b/EventBot/Properties/launchSettings.json index 9c63605..3dacec8 100644 --- a/EventBot/Properties/launchSettings.json +++ b/EventBot/Properties/launchSettings.json @@ -3,8 +3,12 @@ "EventBot": { "commandName": "Project", "environmentVariables": { + "dbconnection": "Server=localhost;Database=eventbot;User=root;Password=tux;", "token": "" } + }, + "Docker": { + "commandName": "Docker" } } } \ No newline at end of file diff --git a/README b/README deleted file mode 100644 index 7e6de9b..0000000 --- a/README +++ /dev/null @@ -1,6 +0,0 @@ - -`set dbconnection="Server=localhost;Database=eventbot;User=root;Password=password;"` - - -`Add-Migration InitialDatabase -Context MySqlDatabaseService -OutputDir Migrations\MySql` -`Add-Migration InitialDatabase -Context SqliteDatabaseService -OutputDir Migrations\Sqlite` \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..2cda7e6 --- /dev/null +++ b/README.md @@ -0,0 +1,13 @@ +# EventBot + +## Environment variables +### `token` variable +This is variable for discord bot's token obtained from discord developer panel. +### `dbconnection` variable +This is environment variable for Mysql / MariaDb database connection. Example connection string: + +```Server=localhost,123;Database=eventbot;User=root;Password=password;``` + + +`Add-Migration InitialDatabase -Context MySqlDatabaseService -OutputDir Migrations\MySql` +`Add-Migration InitialDatabase -Context SqliteDatabaseService -OutputDir Migrations\Sqlite` \ No newline at end of file