* added dockerfile

* cleanup dockerfile

* update Dockerfile and create raspberry dockerfile

* doc & aria2
This commit is contained in:
Gabriel Plassard 2016-07-12 00:57:47 +02:00 committed by Matthieu Grieger
parent 0a4d0aead1
commit 66be67719a
3 changed files with 72 additions and 3 deletions

19
Dockerfile Normal file
View file

@ -0,0 +1,19 @@
FROM alpine:3.3
ENV GOPATH=/
RUN apk add --update ca-certificates go ffmpeg make build-base opus-dev python aria2
RUN apk upgrade
RUN wget https://yt-dl.org/downloads/latest/youtube-dl -O /bin/youtube-dl && chmod a+x /bin/youtube-dl
COPY . /src/github.com/matthieugrieger/mumbledj
COPY config.yaml /root/.config/mumbledj/config.yaml
WORKDIR /src/github.com/matthieugrieger/mumbledj
RUN make
RUN make install
RUN apk del go make build-base && rm -rf /var/cache/apk/*
ENTRYPOINT ["/usr/local/bin/mumbledj"]

View file

@ -13,6 +13,7 @@
* [Via `go get`](#via-go-get-recommended) * [Via `go get`](#via-go-get-recommended)
* [Pre-compiled Binaries](#pre-compiled-binaries-easiest) * [Pre-compiled Binaries](#pre-compiled-binaries-easiest)
* [From Source](#from-source) * [From Source](#from-source)
* [Docker](#docker)
* [Usage](#usage) * [Usage](#usage)
* [Commands](#commands) * [Commands](#commands)
* [Contributing](#contributing) * [Contributing](#contributing)
@ -57,7 +58,7 @@ A YouTube API key must be present in your configuration file in order to use the
**5)** Add the IP address of the machine MumbleDJ will run on in the box that appears (this is optional, but improves security). Click "Create". **5)** Add the IP address of the machine MumbleDJ will run on in the box that appears (this is optional, but improves security). Click "Create".
**6)** You should now see that an API key has been generated. Copy/paste this API key into the configuration file located at `$HOME/.config/mumbledj/mumbledj.yaml`. **6)** You should now see that an API key has been generated. Copy/paste this API key into the configuration file located at `$HOME/.config/mumbledj/mumbledj.yaml`.
#### SoundCloud API Key #### SoundCloud API Key
A SoundCloud client ID must be present in your configuration file in order to use the SoundCloud service within the bot. Below is a guide for retrieving a client ID: A SoundCloud client ID must be present in your configuration file in order to use the SoundCloud service within the bot. Below is a guide for retrieving a client ID:
@ -103,6 +104,35 @@ This will place a compiled `mumbledj` binary in the cloned directory if successf
sudo make install sudo make install
``` ```
### Docker
You can also use [docker](https://www.docker.com) to run mumbledj.
First you need to clone the MumbleDJ repository to your machine:
```
git clone https://github.com/matthieugrieger/mumbledj.git
```
Assuming you have [docker installed](https://www.docker.com/products/docker), you will have to build the image:
```
docker build -t mumbledj .
```
And then you can run it, passing the configuration through the command line:
```
docker run --rm --name=mumbledj mumbledj --server=SERVER --api_keys.youtube=YOUR_YOUTUBE_API_KEY --api_keys.soundcloud=YOUR_SOUNDCLOUD_API_KEY
```
In order to run the process as a deamon and restart it automatically on reboot you can use:
```
docker run -d --restart=unless-stopped --name=mumbledj mumbledj --server=SERVER --api_keys.youtube=YOUR_YOUTUBE_API_KEY --api_keys.soundcloud=YOUR_SOUNDCLOUD_API_KEY
```
You can also install docker on a [raspberry pi](https://www.raspberrypi.org/) for instance with [hypriot](http://blog.hypriot.com/getting-started-with-docker-on-your-arm-device/) or with [archlinux](https://archlinuxarm.org/packages/arm/docker). You just need to build the arm image:
```
docker build -f raspberry.Dockerfile -t mumbledj .
```
## Usage ## Usage
MumbleDJ is a compiled program that is executed via a terminal. MumbleDJ is a compiled program that is executed via a terminal.
@ -114,10 +144,10 @@ NAME:
USAGE: USAGE:
mumbledj [global options] command [command options] [arguments...] mumbledj [global options] command [command options] [arguments...]
VERSION: VERSION:
v3.1.0 v3.1.0
COMMANDS: COMMANDS:
GLOBAL OPTIONS: GLOBAL OPTIONS:
--config value, -c value location of MumbleDJ configuration file (default: "/home/matthieu/.config/mumbledj/config.yaml") --config value, -c value location of MumbleDJ configuration file (default: "/home/matthieu/.config/mumbledj/config.yaml")

20
raspberry.Dockerfile Normal file
View file

@ -0,0 +1,20 @@
FROM hypriot/rpi-alpine-scratch:v3.3
ENV GOPATH=/
RUN echo "https://dl-cdn.alpinelinux.org/alpine/v3.3/community" >> /etc/apk/repositories
RUN apk add --update ca-certificates go ffmpeg make build-base opus-dev python aria2
RUN apk upgrade
RUN wget https://yt-dl.org/downloads/latest/youtube-dl -O /bin/youtube-dl && chmod a+x /bin/youtube-dl
COPY . /src/github.com/matthieugrieger/mumbledj
COPY config.yaml /root/.config/mumbledj/config.yaml
WORKDIR /src/github.com/matthieugrieger/mumbledj
RUN make
RUN make install
RUN apk del go make build-base && rm -rf /var/cache/apk/*
ENTRYPOINT ["/usr/local/bin/mumbledj"]