Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dockerize project #11

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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"]
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:

~~~
Expand Down Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion config.example.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"authToken": "123456:ABC-DEF1234ghIkl-zyx57W2v1u123ew11",
"owner": 34509246,
"owner": 34509246
}
4 changes: 4 additions & 0 deletions docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -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 $@