2021-09-27 00:10:18 +00:00
|
|
|
FROM mcr.microsoft.com/dotnet/sdk:5.0-buster-slim AS build
|
2021-07-18 07:16:42 +00:00
|
|
|
WORKDIR /source
|
|
|
|
|
|
|
|
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/
|
|
|
|
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
|
2021-09-27 00:10:18 +00:00
|
|
|
FROM mcr.microsoft.com/dotnet/runtime:5.0-buster-slim
|
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; \
|
|
|
|
apt-get install -y libopus0 libsodium23 libsqlite3-0 curl ffmpeg python3 sudo; \
|
|
|
|
update-alternatives --install /usr/bin/python python /usr/bin/python3.7 1; \
|
|
|
|
echo 'Defaults>nadeko env_keep+="ASPNETCORE_* DOTNET_* NadekoBot_* shard_id total_shards TZ"' > /etc/sudoers.d/nadeko; \
|
|
|
|
curl -L https://yt-dl.org/downloads/latest/youtube-dl -o /usr/local/bin/youtube-dl; \
|
|
|
|
chmod +x /usr/local/bin/youtube-dl
|
|
|
|
|
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
|
|
|
|
|
|
|
|
VOLUME [ "app/data" ]
|
|
|
|
ENTRYPOINT [ "/usr/local/sbin/docker-entrypoint.sh" ]
|
|
|
|
CMD dotnet NadekoBot.dll "$shard_id" "$total_shards"
|