diff --git a/docker/Dockerfile b/docker/Dockerfile new file mode 100644 index 0000000..a132ecf --- /dev/null +++ b/docker/Dockerfile @@ -0,0 +1,23 @@ +FROM python:3-alpine +LABEL maintainer="Thijs Eilander " + +COPY bootstrap.sh /bootstrap.sh + +RUN set -x; \ + \ + pip install --upgrade pip ;\ + apk add --no-cache --virtual .build-deps \ + git \ + ;\ + \ + cd / ;\ + /usr/bin/git clone https://github.com/Reloisback/Whiteout-Survival-Discord-Bot.git app ;\ + cd /app ;\ + echo 0 > bot_token.txt ;\ + sh -c 'echo y' | python main.py 2>/dev/null ;\ + rm bot_token.txt ;\ + apk del .build-deps ;\ + chmod +x /bootstrap.sh + +WORKDIR /app +ENTRYPOINT ["/bootstrap.sh"] diff --git a/docker/bootstrap.sh b/docker/bootstrap.sh new file mode 100644 index 0000000..2054a88 --- /dev/null +++ b/docker/bootstrap.sh @@ -0,0 +1,17 @@ +#!/bin/sh + +echo "[WSDB] For more information please see https://github.com/Reloisback/Whiteout-Survival-Discord-Bot" + +cd /app + + +if [ ! -n "${DISCORD_BOT_TOKEN}" ]; then + echo "please set DISCORD_BOT_TOKEN" + exit +fi + +if [ -n "${DISCORD_BOT_TOKEN}" ]; then + echo "${DISCORD_BOT_TOKEN}" > bot_token.txt +fi + +sh -c 'echo y' | python main.py diff --git a/docker/docker-compose.py b/docker/docker-compose.py new file mode 100644 index 0000000..66ded9e --- /dev/null +++ b/docker/docker-compose.py @@ -0,0 +1,8 @@ + wos-discord-bot: + image: eilandert/whiteout-survival-discord-bot:v4 + container_name: wos-discord-bot + volumes: + - /opt/docker/wos/db/:/app/db + restart: unless-stopped + environment: + - DISCORD_BOT_TOKEN=