diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..f35d9a82 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,9 @@ +FROM node:11.10.0-slim +RUN apt-get update && apt-get -y install python build-essential +WORKDIR /app +COPY package.json package-lock.json ./ +RUN npm install +COPY . . +RUN chmod +x docker-entrypoint.sh +ENTRYPOINT ["./docker-entrypoint.sh"] +CMD ["node", "server"] diff --git a/README.md b/README.md index 2212b173..42d24fed 100644 --- a/README.md +++ b/README.md @@ -28,6 +28,10 @@ currently *not* supported. ## Install +You can install the bot with classical method or docker. + +### Classical + First install [node-pty dependencies](https://github.com/Microsoft/node-pty#dependencies). For example, if you're in Ubuntu/Debian: ~~~ @@ -57,6 +61,19 @@ When started it will print a `Bot ready.` message when it's up and running. For convenience, you might want to talk to the BotFather and set the command list to the contents of `commands.txt`. +### Docker + +First build docker image +~~~ +docker build . -t shell-bot +~~~ + +To start the bot: + +~~~ +docker run -e AUTH_TOKEN=123456:XXX-YYYY-ZZZZZZZZZZ -e OWNER=123456 shell-bot +~~~ + ## Authorization When first started, the bot will just accept messages coming from your user. diff --git a/config.example.json b/config.example.json index b98c5b46..b2ce688a 100644 --- a/config.example.json +++ b/config.example.json @@ -1,4 +1,4 @@ { "authToken": "123456:ABC-DEF1234ghIkl-zyx57W2v1u123ew11", - "owner": 34509246, + "owner": 34509246 } diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh new file mode 100644 index 00000000..6e5caa3b --- /dev/null +++ b/docker-entrypoint.sh @@ -0,0 +1,4 @@ +#!/usr/bin/env bash +set -euf -o pipefail +sed 's/123456:ABC-DEF1234ghIkl-zyx57W2v1u123ew11/'$AUTH_TOKEN'/; s/34509246/'$OWNER'/' config.example.json > config.json +exec $@