2022-02-09 21:49:27 +00:00
|
|
|
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
|
2021-07-18 07:16:42 +00:00
|
|
|
WORKDIR /source
|
|
|
|
|
2022-04-16 12:44:46 +00:00
|
|
|
COPY src/Nadeko.Medusa/*.csproj src/Nadeko.Medusa/
|
2022-07-27 04:37:04 +00:00
|
|
|
COPY src/Nadeko.Econ/*.csproj src/Nadeko.Econ/
|
|
|
|
COPY src/Nadeko.Common/*.csproj src/Nadeko.Common/
|
2021-07-18 07:16:42 +00:00
|
|
|
COPY src/NadekoBot/*.csproj src/NadekoBot/
|
|
|
|
COPY src/NadekoBot.Coordinator/*.csproj src/NadekoBot.Coordinator/
|
2021-08-04 11:26:48 +00:00
|
|
|
COPY src/NadekoBot.Generators/*.csproj src/NadekoBot.Generators/
|
2021-07-18 07:16:42 +00:00
|
|
|
COPY src/ayu/Ayu.Discord.Voice/*.csproj src/ayu/Ayu.Discord.Voice/
|
2022-07-27 04:37:04 +00:00
|
|
|
COPY NuGet.Config ./
|
2021-07-18 07:16:42 +00:00
|
|
|
RUN dotnet restore src/NadekoBot/
|
|
|
|
|
|
|
|
COPY . .
|
|
|
|
WORKDIR /source/src/NadekoBot
|
2021-09-27 00:10:18 +00:00
|
|
|
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/NadekoBot
|
2021-07-18 07:16:42 +00:00
|
|
|
|
|
|
|
# final stage/image
|
2022-02-09 21:49:27 +00:00
|
|
|
FROM mcr.microsoft.com/dotnet/runtime:6.0
|
2021-07-18 07:16:42 +00:00
|
|
|
WORKDIR /app
|
2021-09-27 00:10:18 +00:00
|
|
|
|
|
|
|
RUN set -xe; \
|
|
|
|
useradd -m nadeko; \
|
|
|
|
apt-get update; \
|
2023-08-16 07:14:39 +00:00
|
|
|
apt-get install -y --no-install-recommends libopus0 libsodium23 libsqlite3-0 curl ffmpeg python3 sudo; \
|
2022-03-18 17:31:27 +00:00
|
|
|
update-alternatives --install /usr/bin/python python /usr/bin/python3.9 1; \
|
2021-09-27 00:10:18 +00:00
|
|
|
echo 'Defaults>nadeko env_keep+="ASPNETCORE_* DOTNET_* NadekoBot_* shard_id total_shards TZ"' > /etc/sudoers.d/nadeko; \
|
2023-08-16 07:14:39 +00:00
|
|
|
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; \
|
2022-05-26 15:01:06 +00:00
|
|
|
apt-get autoremove -y; \
|
|
|
|
apt-get autoclean -y
|
2021-09-27 00:10:18 +00:00
|
|
|
|
2021-07-18 07:16:42 +00:00
|
|
|
COPY --from=build /app ./
|
2021-09-27 00:10:18 +00:00
|
|
|
COPY docker-entrypoint.sh /usr/local/sbin
|
|
|
|
|
|
|
|
ENV shard_id=0
|
|
|
|
ENV total_shards=1
|
2022-07-27 05:00:27 +00:00
|
|
|
ENV NadekoBot__creds=/app/data/creds.yml
|
2021-09-27 00:10:18 +00:00
|
|
|
|
2022-04-10 11:54:49 +00:00
|
|
|
VOLUME [ "/app/data" ]
|
2021-09-27 00:10:18 +00:00
|
|
|
ENTRYPOINT [ "/usr/local/sbin/docker-entrypoint.sh" ]
|
2022-03-18 17:31:27 +00:00
|
|
|
CMD dotnet NadekoBot.dll "$shard_id" "$total_shards"
|