Started cleanup of docker related files
This commit is contained in:
parent
acdb707a31
commit
d9c27021aa
2 changed files with 10 additions and 26 deletions
28
Dockerfile
28
Dockerfile
|
@ -19,29 +19,21 @@ COPY . .
|
|||
WORKDIR /source/src/EllieBot
|
||||
|
||||
# Build and publish the EllieBot project, then clean up unnecessary files
|
||||
RUN set -xe; \
|
||||
dotnet --version; \
|
||||
dotnet restore; \
|
||||
dotnet publish -c Release -o /app --no-restore; \
|
||||
RUN dotnet restore
|
||||
RUN dotnet publish -c Release -o /app --self-contained -r linux-x64 --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
|
||||
chmod +x /app/EllieBot
|
||||
|
||||
# Use the .NET 8.0 runtime as the base image for the final stage
|
||||
FROM mcr.microsoft.com/dotnet/runtime:8.0
|
||||
FROM debian:12.9-slim
|
||||
WORKDIR /app
|
||||
|
||||
# Create a new user, install dependencies, and set up sudoers file
|
||||
RUN set -xe; \
|
||||
useradd -m ellie; \
|
||||
apt-get update; \
|
||||
apt-get install -y --no-install-recommends libopus0 libsodium23 libsqlite3-0 curl ffmpeg python3 sudo; \
|
||||
echo 'Defaults>ellie env_keep+="ASPNETCORE_* DOTNET_* EllieBot_* shard_id total_shards TZ"' > /etc/sudoers.d/ellie; \
|
||||
RUN apt update; \
|
||||
apt install -y curl ffmpeg python3; \
|
||||
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
|
||||
apt autoremove -y;
|
||||
|
||||
# Copy the built application and the entrypoint script from the build stage
|
||||
COPY --from=build /app ./
|
||||
|
@ -50,11 +42,11 @@ COPY docker-entrypoint.sh /usr/local/sbin
|
|||
# Set environment variables
|
||||
ENV shard_id=0
|
||||
ENV total_shards=1
|
||||
ENV EllieBot__creds=/app/data/creds.yml
|
||||
|
||||
# Define the data directory as a volume
|
||||
VOLUME [" /app/data "]
|
||||
VOLUME [ "/app/data" ]
|
||||
|
||||
# Set the entrypoint and default command
|
||||
ENTRYPOINT [ "/usr/local/sbin/docker-entrypoint.sh" ]
|
||||
CMD dotnet EllieBot.dll "$shard_id" "$total_shards"
|
||||
CMD yt-dlp -U &2>/dev/null
|
||||
CMD dotnet EllieBot.dll "$shard_id" "$total_shards"
|
|
@ -13,14 +13,6 @@ do
|
|||
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"
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue