Added Core repo files
This commit is contained in:
parent
a61b98a0f5
commit
044e4c87d9
8 changed files with 117 additions and 7 deletions
13
.dockerignore
Normal file
13
.dockerignore
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
# Ignore all files
|
||||||
|
*
|
||||||
|
|
||||||
|
# Don't ignore nugetconfig
|
||||||
|
!./NuGet.Config
|
||||||
|
|
||||||
|
# Don't ignore src projects
|
||||||
|
!src/**
|
||||||
|
!docker-entrypoint.sh
|
||||||
|
|
||||||
|
# ignore bin and obj folders in projects
|
||||||
|
src/**/bin/*
|
||||||
|
src/**/obj/*
|
46
Dockerfile
46
Dockerfile
|
@ -0,0 +1,46 @@
|
||||||
|
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
|
||||||
|
WORKDIR /source
|
||||||
|
|
||||||
|
COPY src/Ellie.Marmalade/*.csproj src/Ellie.Marmalade/
|
||||||
|
COPY src/EllieBot/*.csproj src/EllieBot/
|
||||||
|
COPY src/EllieBot.Coordinator/*.csproj src/EllieBot.Coordinator/
|
||||||
|
COPY src/EllieBot.Generators/*.csproj src/EllieBot.Generators/
|
||||||
|
COPY src/EllieBot.Voice/*.csproj src/EllieBot.Voice/
|
||||||
|
COPY NuGet.Config ./
|
||||||
|
RUN dotnet restore src/EllieBot/
|
||||||
|
|
||||||
|
COPY . .
|
||||||
|
WORKDIR /source/src/EllieBot
|
||||||
|
RUN set -xe; \
|
||||||
|
dotnet --version; \
|
||||||
|
dotnet publish -c Release -o /app --no-restore; \
|
||||||
|
mv /app/data /app/data_init; \
|
||||||
|
rm -Rf libopus* libsodium* opus.* runtimes/win* runtimes/osx* runtimes/linux-arm* runtimes/linux-mips*; \
|
||||||
|
find /app -type f -exec chmod -x {} \; ;\
|
||||||
|
chmod +x /app/EllieBot
|
||||||
|
|
||||||
|
# final stage/image
|
||||||
|
FROM mcr.microsoft.com/dotnet/runtime:6.0
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
RUN set -xe; \
|
||||||
|
useradd -m ellie; \
|
||||||
|
apt-get update; \
|
||||||
|
apt-get install -y --no-install-recommends libopus0 libsodium23 libsqlite3-0 curl ffmpeg python3 sudo; \
|
||||||
|
update-alternatives --install /usr/bin/python python /usr/bin/python3.9 1; \
|
||||||
|
echo 'Defaults>ellie env_keep+="ASPNETCORE_* DOTNET_* EllieBot_* shard_id total_shards TZ"' > /etc/sudoers.d/ellie; \
|
||||||
|
curl -Lo /usr/local/bin/yt-dlp https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp; \
|
||||||
|
chmod a+rx /usr/local/bin/yt-dlp; \
|
||||||
|
apt-get autoremove -y; \
|
||||||
|
apt-get autoclean -y
|
||||||
|
|
||||||
|
COPY --from=build /app ./
|
||||||
|
COPY docker-entrypoint.sh /usr/local/sbin
|
||||||
|
|
||||||
|
ENV shard_id=0
|
||||||
|
ENV total_shards=1
|
||||||
|
ENV EllieBot__creds=/app/data/creds.yml
|
||||||
|
|
||||||
|
VOLUME [" /app/data "]
|
||||||
|
ENTRYPOINT [ "/usr/local/sbin/docker-entrypoint.sh" ]
|
||||||
|
CMD dotnet EllieBot.dll "$shard_id" "$total_shards"
|
17
EllieBot.sln
17
EllieBot.sln
|
@ -10,11 +10,14 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
|
||||||
CHANGELOG.md = CHANGELOG.md
|
CHANGELOG.md = CHANGELOG.md
|
||||||
Dockerfile = Dockerfile
|
Dockerfile = Dockerfile
|
||||||
LICENSE = LICENSE
|
LICENSE = LICENSE
|
||||||
|
migrate.ps1 = migrate.ps1
|
||||||
|
NuGet.Config = NuGet.Config
|
||||||
README.md = README.md
|
README.md = README.md
|
||||||
|
remove-migrations.ps1 = remove-migrations.ps1
|
||||||
TODO.md = TODO.md
|
TODO.md = TODO.md
|
||||||
EndProjectSection
|
EndProjectSection
|
||||||
EndProject
|
EndProject
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EllieBot", "src\EllieBot\EllieBot.csproj", "{BCB21472-84D2-4B63-B5DD-31E6A3EC9791}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EllieBot", "src\EllieBot\EllieBot.csproj", "{4D9001F7-B3E8-48FE-97AA-CFD36DA65A64}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EllieBot.Tests", "src\EllieBot.Tests\EllieBot.Tests.csproj", "{179DF3B3-AD32-4335-8231-9818338DF3A2}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EllieBot.Tests", "src\EllieBot.Tests\EllieBot.Tests.csproj", "{179DF3B3-AD32-4335-8231-9818338DF3A2}"
|
||||||
EndProject
|
EndProject
|
||||||
|
@ -26,7 +29,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EllieBot.VotesApi", "src\El
|
||||||
EndProject
|
EndProject
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ellie.Marmalade", "src\Ellie.Marmalade\Ellie.Marmalade.csproj", "{76AC715D-12FF-4CBE-9585-A861139A2D0C}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ellie.Marmalade", "src\Ellie.Marmalade\Ellie.Marmalade.csproj", "{76AC715D-12FF-4CBE-9585-A861139A2D0C}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EllieBot.Voice", "src\EllieBot.Voice\EllieBot.Voice.csproj", "{1D93CE3C-80B4-49C7-A9A2-99988920AAEC}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EllieBot.Voice", "src\EllieBot.Voice\EllieBot.Voice.csproj", "{1D93CE3C-80B4-49C7-A9A2-99988920AAEC}"
|
||||||
EndProject
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
@ -34,10 +37,10 @@ Global
|
||||||
Release|Any CPU = Release|Any CPU
|
Release|Any CPU = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
{BCB21472-84D2-4B63-B5DD-31E6A3EC9791}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
{4D9001F7-B3E8-48FE-97AA-CFD36DA65A64}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
{BCB21472-84D2-4B63-B5DD-31E6A3EC9791}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{4D9001F7-B3E8-48FE-97AA-CFD36DA65A64}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{BCB21472-84D2-4B63-B5DD-31E6A3EC9791}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{4D9001F7-B3E8-48FE-97AA-CFD36DA65A64}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{BCB21472-84D2-4B63-B5DD-31E6A3EC9791}.Release|Any CPU.Build.0 = Release|Any CPU
|
{4D9001F7-B3E8-48FE-97AA-CFD36DA65A64}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
{179DF3B3-AD32-4335-8231-9818338DF3A2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
{179DF3B3-AD32-4335-8231-9818338DF3A2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
{179DF3B3-AD32-4335-8231-9818338DF3A2}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{179DF3B3-AD32-4335-8231-9818338DF3A2}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{179DF3B3-AD32-4335-8231-9818338DF3A2}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{179DF3B3-AD32-4335-8231-9818338DF3A2}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
@ -67,7 +70,7 @@ Global
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(NestedProjects) = preSolution
|
GlobalSection(NestedProjects) = preSolution
|
||||||
{BCB21472-84D2-4B63-B5DD-31E6A3EC9791} = {B28FB883-9688-41EB-BF5A-945F4A4EB628}
|
{4D9001F7-B3E8-48FE-97AA-CFD36DA65A64} = {B28FB883-9688-41EB-BF5A-945F4A4EB628}
|
||||||
{179DF3B3-AD32-4335-8231-9818338DF3A2} = {B28FB883-9688-41EB-BF5A-945F4A4EB628}
|
{179DF3B3-AD32-4335-8231-9818338DF3A2} = {B28FB883-9688-41EB-BF5A-945F4A4EB628}
|
||||||
{A631DDF0-3AD1-4CB9-8458-314B1320868A} = {B28FB883-9688-41EB-BF5A-945F4A4EB628}
|
{A631DDF0-3AD1-4CB9-8458-314B1320868A} = {B28FB883-9688-41EB-BF5A-945F4A4EB628}
|
||||||
{CB1A5307-DD85-4795-8A8A-A25D36DADC51} = {B28FB883-9688-41EB-BF5A-945F4A4EB628}
|
{CB1A5307-DD85-4795-8A8A-A25D36DADC51} = {B28FB883-9688-41EB-BF5A-945F4A4EB628}
|
||||||
|
|
6
NuGet.Config
Normal file
6
NuGet.Config
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
<configuration>
|
||||||
|
<packageSources>
|
||||||
|
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
|
||||||
|
<add key="toastielab.dev" value="https://toastielab.dev/api/packages/ellie/nuget/index.json" protocolVersion="3" />
|
||||||
|
</packageSources>
|
||||||
|
</configuration>
|
|
@ -1,5 +1,7 @@
|
||||||
# Ellie
|
# Ellie
|
||||||
|
|
||||||
|
[![Please don't upload to GitHub](https://nogithub.codeberg.page/badge.svg)](https://nogithub.codeberg.page)
|
||||||
|
|
||||||
## Small disclaimer
|
## Small disclaimer
|
||||||
|
|
||||||
All the code in this repo may not be production ready yet and if you want to try and run a version of this by yourself you are on your own.
|
All the code in this repo may not be production ready yet and if you want to try and run a version of this by yourself you are on your own.
|
||||||
|
|
28
docker-entrypoint.sh
Normal file
28
docker-entrypoint.sh
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
#!/bin/sh
|
||||||
|
set -e;
|
||||||
|
|
||||||
|
data_init=/app/data_init
|
||||||
|
data=/app/data
|
||||||
|
|
||||||
|
# populate /app/data if empty
|
||||||
|
for i in $(ls $data_init)
|
||||||
|
do
|
||||||
|
if [ ! -e "$data/$i" ]; then
|
||||||
|
[ -f "$data_init/$i" ] && cp "$data_init/$i" "$data/$i"
|
||||||
|
[ -d "$data_init/$i" ] && cp -r "$data_init/$i" "$data/$i"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
# creds.yml migration
|
||||||
|
if [ -f /app/creds.yml ]; then
|
||||||
|
echo "Default location for creds.yml is now /app/data/creds.yml."
|
||||||
|
echo "Please move your creds.yml and update your docker-compose.yml accordingly."
|
||||||
|
|
||||||
|
export Ellie_creds=/app/creds.yml
|
||||||
|
fi
|
||||||
|
|
||||||
|
# ensure ellie can write on /app/data
|
||||||
|
chown -R ellie:ellie "$data"
|
||||||
|
|
||||||
|
# drop to regular user and launch command
|
||||||
|
exec sudo -u ellie "$@"
|
9
migrate.ps1
Normal file
9
migrate.ps1
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
if ($args.Length -eq 0) {
|
||||||
|
Write-Host "Please provide a migration name." -ForegroundColor Red
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$migrationName = $args[0]
|
||||||
|
dotnet ef migrations add $migrationName -c SqliteContext -p src/EllieBot/EllieBot.csproj
|
||||||
|
dotnet ef migrations add $migrationName -c PostgreSqlContext -p src/EllieBot/EllieBot.csproj
|
||||||
|
dotnet ef migrations add $migrationName -c MysqlContext -p src/EllieBot/EllieBot.csproj
|
||||||
|
}
|
3
remove-migrations.ps1
Normal file
3
remove-migrations.ps1
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
dotnet ef migrations remove -c SqliteContext -f -p src/EllieBot/EllieBot.csproj
|
||||||
|
dotnet ef migrations remove -c PostgreSqlContext -f -p src/EllieBot/EllieBot.csproj
|
||||||
|
dotnet ef migrations remove -c MysqlContext -f -p src/EllieBot/EllieBot.csproj
|
Loading…
Reference in a new issue