├── .dockerignore ├── .gitignore ├── Dockerfile ├── LICENSE ├── README.md ├── _config.yml ├── discord ├── Dockerfile ├── docker-compose.yml ├── entrypoint.sh └── install.sh ├── docker-compose.yml ├── release_as_latest.sh └── release_version.sh /.dockerignore: -------------------------------------------------------------------------------- 1 | .git/ 2 | discord/ 3 | LICENSE 4 | README.md 5 | install.sh 6 | release_as_latest.sh 7 | release_version.sh 8 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # docker-compose local volume names 2 | data 3 | scripts 4 | .vscode 5 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM sinusbot/docker:1.0.2-discord 2 | 3 | LABEL description="SinusBot - TeamSpeak 3 and Discord music bot." 4 | LABEL version="1.0.2" 5 | 6 | # Install dependencies and clean up afterwards 7 | RUN apt-get update && \ 8 | DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends x11vnc xvfb libxcursor1 libnss3 libegl1-mesa libasound2 libglib2.0-0 libxcomposite-dev less jq && \ 9 | rm -rf /tmp/* /var/tmp/* /var/lib/apt/lists/* 10 | 11 | # Download/Install TeamSpeak Client 12 | RUN bash install.sh teamspeak 13 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 SinusBot 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # SinusBot Docker image 2 | 3 | [![Docker Pulls](https://img.shields.io/docker/pulls/sinusbot/docker.svg)](https://hub.docker.com/r/sinusbot/docker) 4 | 5 | ## Features 6 | 7 | - Easily updatable (see [instructions](#Updating) below) 8 | - Minimal dependencies to the Host system 9 | - Integrated Text-to-Speech engine 10 | - Compatible with macOS 11 | 12 | ## Disclaimer 13 | 14 | By using this image you accept the [Privacy statement of the TeamSpeak Systems GmbH](https://www.teamspeak.com/en/privacy-and-terms), the [SinusBot Privacy Policy](https://forum.sinusbot.com/help/privacy-policy/) and SinusBot license agreement. 15 | 16 | > © 2013-2021 Michael Friese. All rights reserved. (https://www.sinusbot.com) 17 | > 18 | > This software is free for personal use only. If you want to use it commercially, please contact the author. 19 | > 20 | > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | > 22 | > You may NOT redistribute this software or use this software commercially without prior written permission from the author. 23 | 24 | *TeamSpeak 3 is © TeamSpeak Systems GmbH. This product and the author is in no way affiliated with TeamSpeak Systems GmbH.* 25 | 26 | *Discord is © Hammer & Chisel Inc. This product and the author is in no way affiliated with Hammer & Chisel Inc.* 27 | 28 | ## Usage 29 | 30 | ### docker 31 | 32 | #### root (not recommended) 33 | 34 | ```bash 35 | docker run -d -p 8087:8087 \ 36 | -v /opt/sinusbot/scripts:/opt/sinusbot/scripts \ 37 | -v /opt/sinusbot/data:/opt/sinusbot/data \ 38 | --name sinusbot \ 39 | sinusbot/docker 40 | ``` 41 | 42 | #### unprivileged user 43 | 44 | It is recommended that you run the SinusBot as a non-root user, even though the docker container is mostly isolated from the host. 45 | This can be done as described in the following: 46 | 47 | - add a new user: 48 | 49 | `useradd --no-create-home -s /sbin/nologin -U sinusbot` 50 | - create the required folders if they don't exist: 51 | 52 | `mkdir -p /opt/sinusbot/data /opt/sinusbot/scripts` 53 | - give the user permissions to the folders: 54 | 55 | `chown -R sinusbot:sinusbot /opt/sinusbot` 56 | - Run the docker image with the `UID` and `GID` environment variables set to the correct user- and group-ID as shown below: 57 | 58 | ```bash 59 | docker run -d -p 8087:8087 \ 60 | -v /opt/sinusbot/scripts:/opt/sinusbot/scripts \ 61 | -v /opt/sinusbot/data:/opt/sinusbot/data \ 62 | -e UID=$(id -u sinusbot) \ 63 | -e GID=$(id -g sinusbot) \ 64 | --name sinusbot \ 65 | sinusbot/docker 66 | ``` 67 | 68 | ### docker-compose 69 | 70 | Download the [docker-compose file](docker-compose.yml) in it's own directory and start it with `docker-compose up`. 71 | 72 | To run via docker-compose as a non-root user, follow the docker instruction above to create a `sinusbot` user. Then append the following to your `docker-compose.yml`: 73 | 74 | ```yaml 75 | environment: 76 | UID: # insert output of `id -u sinusbot` 77 | GID: # insert output of `id -g sinusbot` 78 | ``` 79 | 80 | ## Tags 81 | 82 | - `latest` is the default tag 83 | - `discord` is a discord-only version of `latest` and does not contain the TeamSpeak client with additional dependencies 84 | - every release is tagged with it's version (for example: `1.0.0-beta.6-f290553`) and a discord-only tag (for example: `1.0.0-beta.6-f290553-discord`) 85 | 86 | You view the [full list of tags](https://hub.docker.com/r/sinusbot/docker/tags) for specific versions. 87 | 88 | ## Get Password 89 | 90 | After starting the SinusBot docker image with `docker run` an ID will be returned in the next line. 91 | Use the command `docker logs sinusbot` to print out the logs of the container. 92 | The beginning of the log should contain your credentials: 93 | 94 | ```txt 95 | [...] 96 | ------------------------------------------------------------------------------- 97 | Generating new bot instance with account 'admin' and password 'YOUR_PASSWORD_HERE' 98 | PLEASE MAKE SURE TO CHANGE THE PASSWORD DIRECTLY AFTER YOUR FIRST LOGIN!!! 99 | ------------------------------------------------------------------------------- 100 | [...] 101 | ``` 102 | 103 | ## Override Password 104 | 105 | By setting the `OVERRIDE_PASSWORD` environment variable you can override the password of the SinusBot. Example: 106 | 107 | ```bash 108 | docker run -d -p 8087:8087 \ 109 | -v /opt/sinusbot/scripts:/opt/sinusbot/scripts \ 110 | -v /opt/sinusbot/data:/opt/sinusbot/data \ 111 | -e OVERRIDE_PASSWORD=foobar \ 112 | --name sinusbot sinusbot/docker 113 | ``` 114 | 115 | ## License 116 | 117 | To use your [license](https://sinusbot.github.io/docs/licenses/), which you've got from the [License Page in the Forum](https://forum.sinusbot.com/license), you need to save the `private.dat` into the data folder. 118 | 119 | After restarting the container (`docker restart sinusbot`) your licensed instances should appear automatically. 120 | 121 | ## Updating 122 | 123 | Docker containers themselves should not store application data, instead the data is stored in volumes (in this case `scripts` and `data`). 124 | To upgrade a container you need to remove and re-run it as shown below. 125 | 126 | 1. Stop and remove the old container. 127 | 128 | ```bash 129 | docker stop sinusbot && docker rm sinusbot 130 | ``` 131 | 132 | 2. Pull the latest image: 133 | 134 | ```bash 135 | docker pull sinusbot/docker 136 | ``` 137 | 138 | 3. Create a new container with your volumes as described in the [usage](#usage) section above. 139 | 140 | *It is also possible to automate this process by running [Watchtower](https://containrrr.github.io/watchtower/).* 141 | 142 | ## Text-to-Speech 143 | 144 | The Chromium Text-to-Speech engine is pre-installed but disabled by default due to higher cpu/memory usage. 145 | 146 | To enable it you simply need to set the `TTS.Enabled` property to `true` in the `config.ini` stored in the `data` volume (`/opt/sinusbot/data`) and restart your container (`docker restart sinusbot`). 147 | Once it's enabled it can be used by setting the locale to `en-US` or `de-DE` in the instance settings. 148 | 149 | ## Discord only image 150 | 151 | There is an image for discord only usage, this won't contain the TeamSpeak client with the additional dependencies. 152 | To use it you just have to use the `discord` tag instead of `latest` (default) tag: 153 | 154 | ```bash 155 | docker run -d -p 8087:8087 \ 156 | -v /opt/sinusbot/scripts:/opt/sinusbot/scripts \ 157 | -v /opt/sinusbot/data:/opt/sinusbot/data \ 158 | --name sinusbot sinusbot/docker:discord 159 | ``` 160 | 161 | ## docker-compose with TeamSpeak 3 Server 162 | 163 | In the SinusBot you have to use the network alias `teamspeak.docker.local` as hostname. 164 | 165 | ```yaml 166 | # docker-compose.yml 167 | version: '2' 168 | services: 169 | teamspeak: 170 | image: teamspeak 171 | restart: always 172 | ports: 173 | - 9987:9987/udp 174 | - 10011:10011 175 | - 30033:30033 176 | environment: 177 | TS3SERVER_LICENSE: accept 178 | networks: 179 | mynetwork: 180 | aliases: 181 | - teamspeak.docker.local 182 | 183 | sinusbot: 184 | image: sinusbot/docker 185 | restart: always 186 | ports: 187 | - 8087:8087 188 | volumes: 189 | - /opt/sinusbot/scripts:/opt/sinusbot/scripts 190 | - /opt/sinusbot/data:/opt/sinusbot/data 191 | networks: 192 | - mynetwork 193 | networks: 194 | mynetwork: 195 | driver: bridge 196 | ``` 197 | 198 | ## Development 199 | 200 | ### Deploy Version 201 | 202 | To build and release a new version, clone this repository and run: 203 | 204 | ```bash 205 | docker login 206 | ./release_as_latest.sh 207 | ``` 208 | 209 | Replace `` with the version, e.g. `1.0.0-beta.10-202ee4d`. 210 | 211 | This will build and upload the following tags: `-discord`, ``, `discord`, `latest` 212 | 213 | `./release_version.sh` does the same but without setting `discord`, `latest`. 214 | -------------------------------------------------------------------------------- /_config.yml: -------------------------------------------------------------------------------- 1 | theme: jekyll-theme-cayman -------------------------------------------------------------------------------- /discord/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM debian:buster-slim 2 | 3 | LABEL description="SinusBot - Discord only image" 4 | LABEL version="1.0.2" 5 | 6 | # Install dependencies and clean up afterwards 7 | RUN apt-get update && \ 8 | DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends ca-certificates bzip2 unzip curl python3 procps libpci3 libxslt1.1 libxkbcommon0 locales && \ 9 | rm -rf /tmp/* /var/tmp/* /var/lib/apt/lists/* 10 | 11 | # Set locale 12 | RUN sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && locale-gen 13 | ENV LC_ALL en_US.UTF-8 14 | ENV LANG en_US.UTF-8 15 | ENV LANGUAGE en_US:en 16 | 17 | WORKDIR /opt/sinusbot 18 | 19 | ADD install.sh . 20 | RUN chmod 755 install.sh 21 | 22 | # Download/Install SinusBot 23 | RUN bash install.sh sinusbot 24 | 25 | # Download/Install yt-dlp 26 | RUN bash install.sh yt-dlp 27 | 28 | # Download/Install Text-to-Speech 29 | RUN bash install.sh text-to-speech 30 | 31 | ADD entrypoint.sh . 32 | RUN chmod 755 entrypoint.sh 33 | 34 | EXPOSE 8087 35 | 36 | VOLUME ["/opt/sinusbot/data", "/opt/sinusbot/scripts"] 37 | 38 | ENTRYPOINT ["/opt/sinusbot/entrypoint.sh"] 39 | 40 | HEALTHCHECK --interval=1m --timeout=10s \ 41 | CMD curl --no-keepalive -f http://localhost:8087/api/v1/botId || exit 1 42 | -------------------------------------------------------------------------------- /discord/docker-compose.yml: -------------------------------------------------------------------------------- 1 | sinusbot: 2 | image: sinusbot/docker:discord 3 | restart: always 4 | ports: 5 | - 8087:8087 6 | volumes: 7 | - ./scripts:/opt/sinusbot/scripts 8 | - ./data:/opt/sinusbot/data -------------------------------------------------------------------------------- /discord/entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # print kernel/system info 4 | uname -srmo 5 | date 6 | 7 | if [ -d "default_scripts" ]; then 8 | mv default_scripts/* scripts 9 | rm -r default_scripts 10 | echo "Copied default scripts" 11 | fi 12 | 13 | if [ ! -f "data/config.ini" ]; then 14 | cp config.ini.configured data/config.ini 15 | fi 16 | 17 | ln -fs data/config.ini config.ini 18 | 19 | SINUSBOT="./sinusbot" 20 | YTDL="yt-dlp" 21 | 22 | echo "Updating yt-dlp..." 23 | $YTDL --restrict-filename -U 24 | $YTDL --version 25 | 26 | PID=0 27 | 28 | # graceful shutdown on kill 29 | kill_handler() { 30 | echo "Shutting down..." 31 | kill -s SIGINT -$(ps -o pgid= $PID | grep -o '[0-9]*') 32 | while [ -e /proc/$PID ]; do 33 | sleep .5 34 | done 35 | exit 0 36 | } 37 | 38 | trap 'kill ${!}; kill_handler' SIGTERM # docker stop 39 | trap 'kill ${!}; kill_handler' SIGINT # CTRL + C 40 | 41 | if [[ -v UID ]] || [[ -v GID ]]; then 42 | # WORKAROUND for `setpriv: libcap-ng is too old for "all" caps`, previously "-all" was used here 43 | # create a list to drop all capabilities supported by current kernel 44 | cap_prefix="-cap_" 45 | caps="$cap_prefix$(seq -s ",$cap_prefix" 0 $(cat /proc/sys/kernel/cap_last_cap))" 46 | 47 | SETPRIV="setpriv --clear-groups --inh-caps=$caps" 48 | 49 | # set user id 50 | if [[ -v UID ]]; then 51 | echo "User ID: $UID" 52 | SETPRIV="$SETPRIV --reuid=$UID" 53 | echo "Change file owner..." 54 | chown -R "$UID" "$PWD" 55 | fi 56 | # set group id 57 | if [[ -v GID ]]; then 58 | echo "Group ID: $GID" 59 | SETPRIV="$SETPRIV --regid=$GID" 60 | echo "Change file group..." 61 | chown -R ":$GID" "$PWD" 62 | fi 63 | echo "Drop privileges..." 64 | SINUSBOT="$SETPRIV $SINUSBOT" 65 | YTDL="$SETPRIV $YTDL" 66 | fi 67 | 68 | echo "Clearing yt-dlp cache..." 69 | $YTDL --rm-cache-dir 70 | 71 | echo "Starting SinusBot..." 72 | if [[ -v OVERRIDE_PASSWORD ]]; then 73 | echo "Overriding password..." 74 | $SINUSBOT --override-password="${OVERRIDE_PASSWORD}" & 75 | else 76 | $SINUSBOT & 77 | fi 78 | 79 | PID=$! 80 | echo "PID: $PID" 81 | 82 | while true; do 83 | tail -f /dev/null & wait ${!} 84 | done 85 | -------------------------------------------------------------------------------- /discord/install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | SINUSBOT_VERSION="1.0.2-amd64" 6 | 7 | case "$1" in 8 | 9 | "sinusbot") 10 | echo "Downloading SinusBot..." 11 | curl -s "https://www.sinusbot.com/pre/sinusbot-$SINUSBOT_VERSION.tar.bz2" | tar xj 12 | chmod 755 sinusbot 13 | mv scripts default_scripts 14 | ln -s data/private.dat private.dat 15 | cp config.ini.dist config.ini.configured 16 | sed -i "s|^TS3Path.*|TS3Path = \"\"|g" config.ini.configured 17 | echo "Successfully installed SinusBot" 18 | ;; 19 | "text-to-speech") 20 | echo "Installing Text-to-Speech..." 21 | mkdir -p tts 22 | cd tts 23 | mkdir tmp 24 | cd tmp 25 | curl -s https://chromium.googlesource.com/chromiumos/platform/assets/+archive/master/speech_synthesis/patts.tar.gz | tar -xz 26 | unzip -q tts_service_x86_64.nexe.zip 27 | 28 | mv tts_service_x86_64.nexe .. 29 | mv voice_lstm_en-US.zvoice .. 30 | mv voice_lstm_de-DE.zvoice .. 31 | 32 | cd .. 33 | rm -rf tmp 34 | cd .. 35 | 36 | cat <> config.ini.configured 37 | [TTS] 38 | Enabled = false 39 | 40 | [[TTS.Modules]] 41 | Locale = "en-US" 42 | Filename = "voice_lstm_en-US.zvoice" 43 | PipelineFile = "voice_lstm_en-US/sfg/pipeline" 44 | Prefix = "voice_lstm_en-US/sfg/" 45 | Instances = 2 46 | 47 | [[TTS.Modules]] 48 | Locale = "de-DE" 49 | Filename = "voice_lstm_de-DE.zvoice" 50 | PipelineFile = "voice_lstm_de-DE/nfh/pipeline" 51 | Prefix = "voice_lstm_de-DE/nfh/" 52 | Instances = 2 53 | EOT 54 | echo "Successfully installed Text-to-Speech" 55 | ;; 56 | "yt-dlp") 57 | echo "Downloading yt-dlp..." 58 | curl -s -L -o /usr/local/bin/yt-dlp https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp 59 | chmod 755 /usr/local/bin/yt-dlp 60 | echo 'YoutubeDLPath = "/usr/local/bin/yt-dlp"' >> config.ini.configured 61 | echo "Successfully installed yt-dlp" 62 | ;; 63 | "teamspeak") 64 | echo "Installing TeamSpeak Client..." 65 | # Get latest TeamSpeak client download URL 66 | DOWNLOAD_URL=$(curl -s https://www.teamspeak.com/versions/client.json | jq -r '.linux.x86_64.mirrors["teamspeak.com"]') 67 | 68 | # Download TeamSpeak client 69 | echo "Downloading TeamSpeak Client..." 70 | curl -s -o TeamSpeak3-Client-linux_amd64.run "$DOWNLOAD_URL" 71 | 72 | # Install TeamSpeak Client 73 | chmod 755 TeamSpeak3-Client-linux_amd64.run 74 | yes | ./TeamSpeak3-Client-linux_amd64.run 75 | rm TeamSpeak3-Client-linux_amd64.run 76 | 77 | # Copy SinusBot plugin 78 | mkdir TeamSpeak3-Client-linux_amd64/plugins 79 | cp plugin/libsoundbot_plugin.so TeamSpeak3-Client-linux_amd64/plugins 80 | 81 | # Remove glx-integration lib 82 | rm TeamSpeak3-Client-linux_amd64/xcbglintegrations/libqxcb-glx-integration.so 83 | 84 | # Set the TS3Path to the config.ini 85 | sed -i "s|^TS3Path.*|TS3Path = \"/opt/sinusbot/TeamSpeak3-Client-linux_amd64/ts3client_linux_amd64\"|g" config.ini.configured 86 | echo "Successfully installed the TeamSpeak Client" 87 | ;; 88 | esac 89 | -------------------------------------------------------------------------------- /docker-compose.yml: -------------------------------------------------------------------------------- 1 | sinusbot: 2 | image: sinusbot/docker 3 | restart: always 4 | ports: 5 | - 8087:8087 6 | volumes: 7 | - ./scripts:/opt/sinusbot/scripts 8 | - ./data:/opt/sinusbot/data 9 | -------------------------------------------------------------------------------- /release_as_latest.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -ex 4 | 5 | VERSION="$1" 6 | 7 | if [[ -z "$VERSION" ]]; then 8 | echo "Usage: ./release_as_latest.sh " 9 | exit 1 10 | fi 11 | 12 | echo "Version: $VERSION" 13 | 14 | IMAGE=sinusbot/docker 15 | 16 | read -p "Pull from git? [Y/n] " -n 1 -r 17 | echo 18 | if [[ $REPLY =~ ^([Yy]| ) ]] || [[ -z $REPLY ]]; then 19 | git pull 20 | fi 21 | 22 | echo "Replacing version in files..." 23 | sed -i '' "s|^SINUSBOT_VERSION=.*|SINUSBOT_VERSION=\"$VERSION\"|g" discord/install.sh 24 | sed -i '' "s|^LABEL version.*|LABEL version=\"$VERSION\"|g" discord/Dockerfile 25 | sed -i '' "s|^FROM sinusbot.*|FROM $IMAGE:$VERSION-discord|g" Dockerfile 26 | sed -i '' "s|^LABEL version.*|LABEL version=\"$VERSION\"|g" Dockerfile 27 | 28 | read -p "Show diff? [y/N] " -n 1 -r 29 | echo 30 | if [[ $REPLY =~ ^([Yy]) ]]; then 31 | git diff 32 | fi 33 | 34 | read -p "Commit changes? [Y/n] " -n 1 -r 35 | echo 36 | if [[ $REPLY =~ ^([Yy]| ) ]] || [[ -z $REPLY ]]; then 37 | git add -A 38 | git commit -m "v$VERSION" 39 | git tag -a "v$VERSION" -m "v$VERSION" 40 | fi 41 | 42 | read -p "Push to git? [Y/n] " -n 1 -r 43 | echo 44 | if [[ $REPLY =~ ^([Yy]| ) ]] || [[ -z $REPLY ]]; then 45 | git push 46 | git push --tags 47 | fi 48 | 49 | read -p "Build images? [Y/n] " -n 1 -r 50 | echo 51 | if [[ $REPLY =~ ^([Yy]| ) ]] || [[ -z $REPLY ]]; then 52 | docker pull debian:buster-slim 53 | docker build --platform linux/amd64 -t "$IMAGE":discord discord 54 | docker tag "$IMAGE":discord "$IMAGE":"$VERSION"-discord 55 | docker build --platform linux/amd64 -t "$IMAGE":latest . 56 | docker tag "$IMAGE":latest "$IMAGE":"$VERSION" 57 | 58 | read -p "Push the builds to docker? (requires docker login) [Y/n] " -n 1 -r 59 | echo 60 | if [[ $REPLY =~ ^([Yy]| ) ]] || [[ -z $REPLY ]]; then 61 | docker push "$IMAGE":"$VERSION"-discord 62 | docker push "$IMAGE":discord 63 | docker push "$IMAGE":"$VERSION" 64 | docker push "$IMAGE":latest 65 | fi 66 | fi 67 | -------------------------------------------------------------------------------- /release_version.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -ex 4 | 5 | VERSION="$1" 6 | 7 | if [[ -z "$VERSION" ]]; then 8 | echo "Usage: ./release_version.sh " 9 | exit 1 10 | fi 11 | 12 | echo "Version: $VERSION" 13 | 14 | IMAGE=sinusbot/docker 15 | 16 | read -p "Pull from git? [Y/n] " -n 1 -r 17 | echo 18 | if [[ $REPLY =~ ^([Yy]| ) ]] || [[ -z $REPLY ]]; then 19 | git pull 20 | fi 21 | 22 | echo "Replacing version in files..." 23 | sed -i '' "s|^SINUSBOT_VERSION=.*|SINUSBOT_VERSION=\"$VERSION\"|g" discord/install.sh 24 | sed -i '' "s|^LABEL version.*|LABEL version=\"$VERSION\"|g" discord/Dockerfile 25 | sed -i '' "s|^FROM sinusbot.*|FROM $IMAGE:$VERSION-discord|g" Dockerfile 26 | sed -i '' "s|^LABEL version.*|LABEL version=\"$VERSION\"|g" Dockerfile 27 | 28 | read -p "Show diff? [y/N] " -n 1 -r 29 | echo 30 | if [[ $REPLY =~ ^([Yy]) ]]; then 31 | git diff 32 | fi 33 | 34 | read -p "Commit changes? [Y/n] " -n 1 -r 35 | echo 36 | if [[ $REPLY =~ ^([Yy]| ) ]] || [[ -z $REPLY ]]; then 37 | git add -A 38 | git commit -m "v$VERSION" 39 | git tag -a "v$VERSION" -m "v$VERSION" 40 | fi 41 | 42 | read -p "Push to git? [Y/n] " -n 1 -r 43 | echo 44 | if [[ $REPLY =~ ^([Yy]| ) ]] || [[ -z $REPLY ]]; then 45 | git push 46 | git push --tags 47 | fi 48 | 49 | read -p "Build images? [Y/n] " -n 1 -r 50 | echo 51 | if [[ $REPLY =~ ^([Yy]| ) ]] || [[ -z $REPLY ]]; then 52 | docker pull debian:buster-slim 53 | docker build --platform linux/amd64 -t "$IMAGE":"$VERSION"-discord discord 54 | docker build --platform linux/amd64 -t "$IMAGE":"$VERSION" . 55 | 56 | read -p "Push the builds to docker? (requires docker login) [Y/n] " -n 1 -r 57 | echo 58 | if [[ $REPLY =~ ^([Yy]| ) ]] || [[ -z $REPLY ]]; then 59 | docker push "$IMAGE":"$VERSION"-discord 60 | docker push "$IMAGE":"$VERSION" 61 | fi 62 | fi 63 | --------------------------------------------------------------------------------