From 028362cf6731a4c39cdbf121ce18edf20e48af68 Mon Sep 17 00:00:00 2001 From: Styler Date: Fri, 15 Dec 2017 14:22:51 +0100 Subject: [PATCH 1/3] Added docker support --- Dockerfile | 24 ++++++++++++++++++++++++ package.json | 4 +++- 2 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..143120a --- /dev/null +++ b/Dockerfile @@ -0,0 +1,24 @@ +FROM ubuntu +MAINTAINER Styler + +FROM ubuntu +WORKDIR /usr/src/app +COPY package*.json ./ + +RUN apt-get update && apt-get -qq -y install curl +RUN curl -sL https://deb.nodesource.com/setup_9.x | bash - +RUN apt-get install -y \ + nodejs \ + libcairo2-dev \ + libjpeg8-dev \ + libpango1.0-dev \ + libgif-dev \ + build-essential \ + g++ + +RUN npm install + +EXPOSE 3002 +COPY . . + +CMD [ "npm", "start" ] \ No newline at end of file diff --git a/package.json b/package.json index 766b2d3..485c52a 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,9 @@ "description": "", "main": "index.js", "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" + "test": "echo \"Error: no test specified\" && exit 1", + "start": "node index.js", + "docker": "docker build -t beebot ." }, "author": "", "license": "ISC", From deaf25e439b367a0b607252b9fab213b60045352 Mon Sep 17 00:00:00 2001 From: Styler Date: Fri, 15 Dec 2017 14:26:44 +0100 Subject: [PATCH 2/3] Added readme --- README.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/README.md b/README.md index 41dc111..dfda9e5 100644 --- a/README.md +++ b/README.md @@ -13,3 +13,14 @@ Then copy the `config.default.json` file to `config.json`, enter your credential ## Usage Add the bot to your discord server with the correct privileges and then run `/bee :emote:` The bot spawns an HTTP server on port 3002 on localhost, so you can use that - `http://host/bee?url=` + +## Docker + +### Build the container +You can build the container with the following command `npm run docker` + +### Run the image +Running your image with -d runs the container in detached mode, leaving the container running in the background. The -p flag redirects a public port to a private port inside the container. Run the image you previously built: +```bash +$ docker run -p 3002:3002 -d beebot:latest +``` \ No newline at end of file From 4c885f86899d53c3205c4f097f73ae11116981ed Mon Sep 17 00:00:00 2001 From: Styler Date: Fri, 15 Dec 2017 14:28:22 +0100 Subject: [PATCH 3/3] removed double --- Dockerfile | 1 - 1 file changed, 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 143120a..d2b652a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,6 @@ FROM ubuntu MAINTAINER Styler -FROM ubuntu WORKDIR /usr/src/app COPY package*.json ./