Skip to content

Docker #421

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

Merged
merged 7 commits into from
Aug 1, 2019
Merged
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
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
language: node_js
after_success:
- npm run report
- sh docker/build.sh
node_js:
- '6'
- '8'
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,21 @@ import config from './config.json';
discordIRC(config);
```

## Docker
As an alternative to running discord-irc directly on your machine, we provide a [Docker container](https://hub.docker.com/reactiflux/discord-irc).
The easiest way to get started with discord-irc is to use Docker Compose...

```bash
In the repository folder:
$ cd docker
$ sudo docker-compose up
```

You'll get an error the first time you run this, because you haven't created your configuration yet.

If you use our Compose file, a new directory will be created - `/srv/discord-irc`. Create a file named `config.json` there,
fill it out as described below, and use `docker-compose up` again to start discord-irc.

## Configuration
First you need to create a Discord bot user, which you can do by following the instructions [here](https://github.com/reactiflux/discord-irc/wiki/Creating-a-discord-bot-&-getting-a-token).

Expand Down
15 changes: 15 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
FROM node:8-alpine
ENV LIBRARY_PATH=/lib:/usr/lib

RUN mkdir /bot
COPY . /bot

WORKDIR /bot

RUN apk add --update tini && \
npm install && \
npm run build && \
mkdir /config

ENTRYPOINT ["/sbin/tini", "--"]
CMD ["npm", "start", "--", "--config", "/config/config.json"]
14 changes: 14 additions & 0 deletions docker/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash

if [[ $TRAVIS_BRANCH == 'master' && $TRAVIS_PULL_REQUEST == 'false' ]]; then
echo "Connecting to docker hub"
echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin

echo "Building..."
docker build -t reactiflux/discord-irc:latest -f docker/Dockerfile .

echo "Pushing image to Docker Hub..."
docker push reactiflux/discord-irc:latest
else
echo "Skipping deploy; This is a PR or not on the master branch"
fi
10 changes: 10 additions & 0 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
version: "3"
services:
discord-irc:
image: reactiflux/discord-irc
container_name: discord-irc

volumes:
- /srv/discord-irc:/config

restart: always