From 3cd51c7cbc9cf0e3fe5b2cfa8e57b53f71112a61 Mon Sep 17 00:00:00 2001 From: kev Date: Sat, 16 Jan 2016 07:19:42 +0800 Subject: [PATCH] add nodebb --- README.md | 2 +- ghost/arm/Dockerfile | 2 +- nodebb/Dockerfile | 40 +++++++++++++++++++++++++++++++++ nodebb/README.md | 33 +++++++++++++++++++++++++++ nodebb/arm/Dockerfile | 40 +++++++++++++++++++++++++++++++++ nodebb/arm/config.example.json | 11 +++++++++ nodebb/arm/docker-compose.yml | 13 +++++++++++ nodebb/arm/docker-entrypoint.sh | 20 +++++++++++++++++ nodebb/config.example.json | 11 +++++++++ nodebb/docker-compose.yml | 13 +++++++++++ nodebb/docker-entrypoint.sh | 20 +++++++++++++++++ 11 files changed, 203 insertions(+), 2 deletions(-) create mode 100644 nodebb/Dockerfile create mode 100644 nodebb/README.md create mode 100644 nodebb/arm/Dockerfile create mode 100644 nodebb/arm/config.example.json create mode 100644 nodebb/arm/docker-compose.yml create mode 100755 nodebb/arm/docker-entrypoint.sh create mode 100644 nodebb/config.example.json create mode 100644 nodebb/docker-compose.yml create mode 100755 nodebb/docker-entrypoint.sh diff --git a/README.md b/README.md index 6aa5361..7068c6c 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,6 @@ dockerfiles - [ ] gitolite - [ ] hashcat - [ ] irc -- [ ] nodebb - [ ] tshark ## DONE @@ -53,6 +52,7 @@ dockerfiles - [x] nginad - [x] nginx - [x] ngrok :+1: +- [x] nodebb - [x] node-red :+1: - [x] node-red-arm :+1: - [x] obfsproxy diff --git a/ghost/arm/Dockerfile b/ghost/arm/Dockerfile index 5cc7c1b..8793d5d 100644 --- a/ghost/arm/Dockerfile +++ b/ghost/arm/Dockerfile @@ -2,7 +2,7 @@ # Dockerfile for ghost-arm # -FROM vimagick/alpine-arm:edge +FROM vimagick/alpine-arm MAINTAINER kev ENV GHOST_VER 0.7.5 diff --git a/nodebb/Dockerfile b/nodebb/Dockerfile new file mode 100644 index 0000000..4428d45 --- /dev/null +++ b/nodebb/Dockerfile @@ -0,0 +1,40 @@ +# +# Dockerfile for nodebb +# + +FROM alpine +MAINTAINER kev + +ENV BB_VER 0.9.3 +ENV BB_URL https://github.com/NodeBB/NodeBB/archive/v$BB_VER.tar.gz +ENV BB_SOURCE /usr/src/nodebb +ENV BB_CONTENT /var/lib/nodebb + +WORKDIR $BB_SOURCE +VOLUME $BB_CONTENT + +RUN set -ex \ + && apk add -U bash \ + imagemagick \ + nodejs \ + openssl \ + && apk add -t TMP build-base \ + curl \ + git \ + openssl-dev \ + python \ + tar \ + && curl -sSL $BB_URL | tar xz --strip 1 \ + && sed -i '/"bufferutil": {/,/},/d; /"utf-8-validate": {/,/},/d' npm-shrinkwrap.json \ + && npm install --production \ + && npm cache clean \ + && apk del TMP \ + && rm -rf /tmp/npm* \ + /var/cache/apk/* + +COPY config.example.json $BB_SOURCE +COPY docker-entrypoint.sh /entrypoint.sh +ENTRYPOINT ["/entrypoint.sh"] + +EXPOSE 4567 +CMD ["npm", "start"] diff --git a/nodebb/README.md b/nodebb/README.md new file mode 100644 index 0000000..eec82f7 --- /dev/null +++ b/nodebb/README.md @@ -0,0 +1,33 @@ +nodebb +====== + +![](https://badge.imagelayers.io/vimagick/nodebb:latest.svg) + +[NodeBB][1] Forum Software is powered by Node.js and built on either a Redis or MongoDB database. + +## docker-compose.yml + +``` +nodebb: + image: vimagick/nodebb + ports: + - "4567:4567" + links: + - redis + restart: always + +redis: + image: redis + ports: + - "127.0.0.1:6379:6379" + restart: always +``` + +## up and running + +``` +$ docker-compose up -d +$ firefox http://localhost:4567 +``` + +[1]: https://nodebb.org/ diff --git a/nodebb/arm/Dockerfile b/nodebb/arm/Dockerfile new file mode 100644 index 0000000..f390227 --- /dev/null +++ b/nodebb/arm/Dockerfile @@ -0,0 +1,40 @@ +# +# Dockerfile for nodebb-arm +# + +FROM vimagick/alpine-arm +MAINTAINER kev + +ENV BB_VER 0.9.3 +ENV BB_URL https://github.com/NodeBB/NodeBB/archive/v$BB_VER.tar.gz +ENV BB_SOURCE /usr/src/nodebb +ENV BB_CONTENT /var/lib/nodebb + +WORKDIR $BB_SOURCE +VOLUME $BB_CONTENT + +RUN set -ex \ + && apk add -U bash \ + imagemagick \ + nodejs \ + openssl \ + && apk add -t TMP build-base \ + curl \ + git \ + openssl-dev \ + python \ + tar \ + && curl -sSL $BB_URL | tar xz --strip 1 \ + && sed -i '/"bufferutil": {/,/},/d; /"utf-8-validate": {/,/},/d' npm-shrinkwrap.json \ + && npm install --production \ + && npm cache clean \ + && apk del TMP \ + && rm -rf /tmp/npm* \ + /var/cache/apk/* + +COPY config.example.json $BB_SOURCE +COPY docker-entrypoint.sh /entrypoint.sh +ENTRYPOINT ["/entrypoint.sh"] + +EXPOSE 4567 +CMD ["npm", "start"] diff --git a/nodebb/arm/config.example.json b/nodebb/arm/config.example.json new file mode 100644 index 0000000..ebf4e86 --- /dev/null +++ b/nodebb/arm/config.example.json @@ -0,0 +1,11 @@ +{ + "url": "http://localhost:4567", + "secret": "SECRET", + "database": "redis", + "redis": { + "host": "redis", + "port": "6379", + "password": "", + "database": "0" + } +} diff --git a/nodebb/arm/docker-compose.yml b/nodebb/arm/docker-compose.yml new file mode 100644 index 0000000..1e0b5e1 --- /dev/null +++ b/nodebb/arm/docker-compose.yml @@ -0,0 +1,13 @@ +nodebb: + image: vimagick/nodebb-arm + ports: + - "4567:4567" + links: + - redis + restart: always + +redis: + image: redis + ports: + - "127.0.0.1:6379:6379" + restart: always diff --git a/nodebb/arm/docker-entrypoint.sh b/nodebb/arm/docker-entrypoint.sh new file mode 100755 index 0000000..9f68f2c --- /dev/null +++ b/nodebb/arm/docker-entrypoint.sh @@ -0,0 +1,20 @@ +#!/bin/bash +set -e + +export NODE_ENV=production +export silent=false +export daemon=false + +if [[ "$*" == npm*start* ]]; then + if [ ! -e "$BB_CONTENT/config.json" ]; then + sed "s/SECRET/$(node -e 'console.log(require("node-uuid").v4())')/" \ + "$BB_SOURCE/config.example.json" > "$BB_CONTENT/config.json" + npm install connect-redis + fi + + ln -sf "$BB_CONTENT/config.json" "$BB_SOURCE/config.json" + + exec "$@" +fi + +exec "$@" diff --git a/nodebb/config.example.json b/nodebb/config.example.json new file mode 100644 index 0000000..ebf4e86 --- /dev/null +++ b/nodebb/config.example.json @@ -0,0 +1,11 @@ +{ + "url": "http://localhost:4567", + "secret": "SECRET", + "database": "redis", + "redis": { + "host": "redis", + "port": "6379", + "password": "", + "database": "0" + } +} diff --git a/nodebb/docker-compose.yml b/nodebb/docker-compose.yml new file mode 100644 index 0000000..9fbb55d --- /dev/null +++ b/nodebb/docker-compose.yml @@ -0,0 +1,13 @@ +nodebb: + image: vimagick/nodebb + ports: + - "4567:4567" + links: + - redis + restart: always + +redis: + image: redis + ports: + - "127.0.0.1:6379:6379" + restart: always diff --git a/nodebb/docker-entrypoint.sh b/nodebb/docker-entrypoint.sh new file mode 100755 index 0000000..9f68f2c --- /dev/null +++ b/nodebb/docker-entrypoint.sh @@ -0,0 +1,20 @@ +#!/bin/bash +set -e + +export NODE_ENV=production +export silent=false +export daemon=false + +if [[ "$*" == npm*start* ]]; then + if [ ! -e "$BB_CONTENT/config.json" ]; then + sed "s/SECRET/$(node -e 'console.log(require("node-uuid").v4())')/" \ + "$BB_SOURCE/config.example.json" > "$BB_CONTENT/config.json" + npm install connect-redis + fi + + ln -sf "$BB_CONTENT/config.json" "$BB_SOURCE/config.json" + + exec "$@" +fi + +exec "$@"