add env to specify bot version, update readme
This commit is contained in:
parent
d0a3d1f17e
commit
e169bfedd2
3 changed files with 41 additions and 24 deletions
|
|
@ -8,10 +8,12 @@ RUN install_packages openjdk-11-jre-headless wget curl grep \
|
|||
|
||||
STOPSIGNAL SIGTERM
|
||||
|
||||
ENV BOT_VERSION latest
|
||||
|
||||
COPY run_bot.sh /app/run_bot.sh
|
||||
RUN chmod 700 /app/run_bot.sh
|
||||
RUN chmod +x /app/run_bot.sh
|
||||
|
||||
WORKDIR /app
|
||||
VOLUME /config
|
||||
VOLUME /config
|
||||
|
||||
CMD ["./run_bot.sh"]
|
||||
|
|
|
|||
39
README.md
39
README.md
|
|
@ -1,31 +1,25 @@
|
|||
# JMusicBot Docker
|
||||
[](https://github.com/jagrosh/MusicBot/releases/latest)
|
||||
[](https://hub.docker.com/r/yojoshb/jmusicbot)
|
||||

|
||||

|
||||
|
||||
Docker container for the latest version of [JMusicBot](https://github.com/jagrosh/MusicBot)
|
||||
A simple Docker container for [JMusicBot](https://github.com/jagrosh/MusicBot)
|
||||
|
||||
## Usage
|
||||
Place your **config.txt**, **Playlists** folder, and **serversettings.json** file (if you have one) in `yourpath/toconfig` to map it to the container. If you need to access the container you can hop into it and get a shell using:
|
||||
- Place your **config.txt**, **Playlists** folder, and **serversettings.json** file (if you have one) in `/your/path/to/config`. This directory will be shared with the container.
|
||||
- You can specify a JMusicBot version using the environment value `BOT_VERSION`. By default it will use the latest version so you do not have to include the value if you don't want to.
|
||||
|
||||
```bash
|
||||
docker exec -it jmusicbot /bin/bash
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### Docker CLI
|
||||
### Docker examples
|
||||
- Using docker cli
|
||||
```bash
|
||||
docker run -dit \
|
||||
--name=jmusicbot \
|
||||
-v /yourpath/toconfig:/config \
|
||||
--name=jmusicbot \
|
||||
-v /your/path/to/config:/config \
|
||||
--restart=unless-stopped \
|
||||
ghcr.io/yojoshb/jmusicbot-docker
|
||||
```
|
||||
|
||||
### Docker Compose
|
||||
|
||||
- Using docker compose
|
||||
```bash
|
||||
---
|
||||
version: "3"
|
||||
|
|
@ -33,7 +27,22 @@ services:
|
|||
jmusicbot:
|
||||
image: ghcr.io/yojoshb/jmusicbot-docker
|
||||
container_name: jmusicbot
|
||||
environment:
|
||||
- BOT_VERSION=0.3.9 # You can leave this out if you just want to run the latest version
|
||||
volumes:
|
||||
- /yourpath/toconfig:/config
|
||||
- /your/path/to/config:/config
|
||||
restart: unless-stopped
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
#### Debugging
|
||||
- If you need to access the container you can hop into it and get a shell using:
|
||||
```bash
|
||||
docker exec -it jmusicbot /bin/bash
|
||||
```
|
||||
|
||||
- Or read the logs if your having issues
|
||||
```bash
|
||||
docker logs jmusicbot
|
||||
```
|
||||
20
run_bot.sh
20
run_bot.sh
|
|
@ -1,11 +1,17 @@
|
|||
#!/bin/sh
|
||||
#!/bin/bash
|
||||
|
||||
echo "Starting JMusicBot"
|
||||
# Set the default version to latest
|
||||
VER_DEFAULT=$(curl --silent "https://api.github.com/repos/jagrosh/MusicBot/releases/latest" | grep -Po '"tag_name": "\K.*?(?=")')
|
||||
|
||||
VER=$(curl --silent "https://api.github.com/repos/jagrosh/MusicBot/releases/latest" | grep -Po '"tag_name": "\K.*?(?=")')
|
||||
|
||||
if [ ! -f JMusicBot-$VER.jar ]; then
|
||||
wget https://github.com/jagrosh/MusicBot/releases/download/$VER/JMusicBot-$VER.jar
|
||||
# If the ENV is not explicitly set, use the sourced ENV from the Dockerfile
|
||||
if [ $BOT_VERSION == "latest" ]; then
|
||||
BOT_VERSION=$VER_DEFAULT
|
||||
fi
|
||||
|
||||
java -Dnogui=true -Dconfig=/config/config.txt -jar JMusicBot-$VER.jar
|
||||
echo -e "Downloading JMusicBot $BOT_VERSION"
|
||||
if [ ! -f JMusicBot-$BOT_VERSION.jar ]; then
|
||||
wget https://github.com/jagrosh/MusicBot/releases/download/$BOT_VERSION/JMusicBot-$BOT_VERSION.jar
|
||||
fi
|
||||
|
||||
echo -e "Starting JMusicBot $BOT_VERSION"
|
||||
java -Dnogui=true -Dconfig=/config/config.txt -jar JMusicBot-$BOT_VERSION.jar
|
||||
|
|
|
|||
Loading…
Reference in a new issue