Build and Test / Build and Test (push) Canceled after 1m24s
Fork of purnell569/MusicBot 0.7.1 (JMusicBot), kept here as a reliable copy with a container image built and served from this Gitea. - README retitled "$uicide Music Bot"; lineage table, Gitea image, Unraid and release instructions. Nothing under src/ changes. - Dockerfile: Maven stage on $BUILDPLATFORM (JAR is arch-neutral, so no QEMU for the build), OCI labels point at this repo and record commit and version via GIT_SHA/VERSION build args. - docker/entrypoint.sh: check the data dir is writable up front (the bot's own error for that is a misleading "another instance is running"), and on a missing config.txt run the bot's generate-config and stop with instructions instead of prompting on a console that does not exist. - deploy/unraid/musicbot.xml: Unraid template, --user 99:100 default. - .gitea/workflows/build-and-test.yml: mvn verify + docker build on push; its presence makes Gitea ignore the GitHub-only workflows in .github/. - scripts/build-and-publish-unraid.sh + docs/PUBLISHING.md: release runbook (keychain-safe registry push, release with zipped JAR). - docker-compose.example.yml points at the Gitea image. Upstream's v0.7.1 tag is preserved as upstream/v0.7.1; this repository's own release tag v0.7.1 is on this commit. Co-Authored-By: Claude Fable 5.1 <[email protected]>
66 lines
2.4 KiB
Bash
66 lines
2.4 KiB
Bash
#!/bin/sh
|
|
set -eu
|
|
|
|
JAR="/app/app.jar"
|
|
|
|
if [ ! -f "$JAR" ]; then
|
|
echo "[ERROR] JAR file not found at /app/app.jar"
|
|
exit 1
|
|
fi
|
|
|
|
echo "[INFO] ========================================"
|
|
echo "[INFO] \$uicide Music Bot (JMusicBot) Containerized"
|
|
echo "[INFO] ========================================"
|
|
echo "[INFO] Selected jar: $JAR"
|
|
echo "[INFO] Working directory: $(pwd)"
|
|
echo "[INFO] Running as: uid=$(id -u) gid=$(id -g)"
|
|
|
|
# The bot keeps config.txt, serversettings.json, Playlists/ and its instance
|
|
# lock in the working directory. If that is not writable the bot's own error is
|
|
# a misleading "Another instance of JMusicBot is already running", so check
|
|
# first and say what is actually wrong.
|
|
if ! touch .write-test 2>/dev/null; then
|
|
echo "[ERROR] $(pwd) is not writable by uid $(id -u)."
|
|
echo "[ERROR] Make the mounted data directory writable by that user, e.g."
|
|
echo "[ERROR] chown -R $(id -u):$(id -g) <host path mounted at /musicbot>"
|
|
echo "[ERROR] or run the container with --user <uid>:<gid> matching the directory's owner."
|
|
exit 1
|
|
fi
|
|
rm -f .write-test
|
|
|
|
# First run: write the default config.txt (the bot's own generate-config
|
|
# command) and stop, so there is something to edit. Headless, the bot would
|
|
# otherwise prompt for a token on a console that does not exist and exit
|
|
# without writing anything.
|
|
if [ ! -f "config.txt" ]; then
|
|
echo "[INFO] config.txt: Not found - generating the default one"
|
|
java -Dnogui=true --enable-native-access=ALL-UNNAMED -jar "$JAR" generate-config
|
|
echo "[INFO] ========================================"
|
|
echo "[INFO] Wrote $(pwd)/config.txt"
|
|
echo "[INFO] Edit it and set, at minimum:"
|
|
echo "[INFO] discord.token - your Discord bot token"
|
|
echo "[INFO] discord.owner - your Discord user ID"
|
|
echo "[INFO] then start the container again."
|
|
echo "[INFO] ========================================"
|
|
exit 0
|
|
fi
|
|
echo "[INFO] config.txt: Found"
|
|
echo "[INFO] ========================================"
|
|
|
|
# Default JVM options for optimal audio performance (ZGC with sub-ms pauses)
|
|
# Set JAVA_OPTS to override; add -Xms/-Xmx for heap limits if desired
|
|
: "${JAVA_OPTS:=-XX:+UseZGC -XX:+AlwaysPreTouch}"
|
|
|
|
# Build argv
|
|
set -- java -Dnogui=true --enable-native-access=ALL-UNNAMED
|
|
|
|
# Append JAVA_OPTS (either default or user-provided)
|
|
if [ -n "${JAVA_OPTS:-}" ]; then
|
|
# shellcheck disable=SC2086
|
|
set -- "$@" $JAVA_OPTS
|
|
fi
|
|
|
|
set -- "$@" -jar "$JAR"
|
|
|
|
exec "$@"
|