1
0
mirror of https://github.com/vimagick/dockerfiles.git synced 2024-11-24 08:52:15 +02:00

fix nodebb

This commit is contained in:
kev 2016-01-16 12:07:47 +08:00
parent d852efc40a
commit 6c8b38b756
10 changed files with 110 additions and 33 deletions

View File

@ -52,7 +52,7 @@ dockerfiles
- [x] nginad
- [x] nginx
- [x] ngrok :+1:
- [x] nodebb
- [x] nodebb :+1:
- [x] node-red :+1:
- [x] node-red-arm :+1:
- [x] obfsproxy

View File

@ -27,12 +27,12 @@ RUN set -ex \
&& curl -sSL $BB_URL | tar xz --strip 1 \
&& sed -i '/"bufferutil": {/,/},/d; /"utf-8-validate": {/,/},/d' npm-shrinkwrap.json \
&& npm install --production \
&& npm install connect-redis \
&& 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"]

43
nodebb/Dockerfile.debian Normal file
View File

@ -0,0 +1,43 @@
#
# Dockerfile for nodebb
#
FROM debian
MAINTAINER kev <noreply@datageek.info>
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 \
&& apt-get update \
&& apt-get install -y build-essential \
curl \
git \
imagemagick \
libssl1.0.0 \
libssl-dev \
python \
&& curl -sSL https://deb.nodesource.com/setup_4.x | bash - \
&& apt-get install -y nodejs \
&& 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 \
&& apt-get remove -y build-essential \
curl \
git \
libssl-dev \
python \
&& rm -rf /tmp/npm* \
/var/cache/apt/*
COPY docker-entrypoint.sh /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
EXPOSE 4567
CMD ["npm", "start"]

View File

@ -30,4 +30,10 @@ $ docker-compose up -d
$ firefox http://localhost:4567
```
## todo
- Next release: install
- alpine: krb5-libs krb5-dev
- debian: libkrb5-3 libkrb5-dev
[1]: https://nodebb.org/

View File

@ -32,7 +32,6 @@ RUN set -ex \
&& rm -rf /tmp/npm* \
/var/cache/apk/*
COPY config.example.json $BB_SOURCE
COPY docker-entrypoint.sh /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]

View File

@ -0,0 +1,43 @@
#
# Dockerfile for nodebb-arm
#
FROM resin/rpi-raspbian
MAINTAINER kev <noreply@datageek.info>
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 \
&& apt-get update \
&& apt-get install -y build-essential \
curl \
git \
imagemagick \
libssl1.0.0 \
libssl-dev \
python \
&& curl -sSL https://deb.nodesource.com/setup_4.x | bash - \
&& apt-get install -y nodejs \
&& 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 \
&& apt-get remove -y build-essential \
curl \
git \
libssl-dev \
python \
&& rm -rf /tmp/npm* \
/var/cache/apt/*
COPY docker-entrypoint.sh /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
EXPOSE 4567
CMD ["npm", "start"]

View File

@ -1,11 +0,0 @@
{
"url": "http://localhost:4567",
"secret": "SECRET",
"database": "redis",
"redis": {
"host": "redis",
"port": "6379",
"password": "",
"database": "0"
}
}

View File

@ -7,12 +7,16 @@ 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
if [ -e "$BB_SOURCE/config.json" ]; then
cp "$BB_SOURCE/config.json" "$BB_CONTENT/config.json"
fi
fi
ln -sf "$BB_CONTENT/config.json" "$BB_SOURCE/config.json"
if [ -e "$BB_CONTENT/config.json" ]; then
ln -sf "$BB_CONTENT/config.json" "$BB_SOURCE/config.json"
[ -d "$BB_SOURCE/node_modules/redis" ] || npm install redis
[ -d "$BB_SOURCE/node_modules/connect-redis" ] || npm install connect-redis
fi
exec "$@"
fi

View File

@ -1,11 +0,0 @@
{
"url": "http://localhost:4567",
"secret": "SECRET",
"database": "redis",
"redis": {
"host": "redis",
"port": "6379",
"password": "",
"database": "0"
}
}

View File

@ -7,12 +7,16 @@ 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
if [ -e "$BB_SOURCE/config.json" ]; then
cp "$BB_SOURCE/config.json" "$BB_CONTENT/config.json"
fi
fi
ln -sf "$BB_CONTENT/config.json" "$BB_SOURCE/config.json"
if [ -e "$BB_CONTENT/config.json" ]; then
ln -sf "$BB_CONTENT/config.json" "$BB_SOURCE/config.json"
[ -d "$BB_SOURCE/node_modules/redis" ] || npm install redis
[ -d "$BB_SOURCE/node_modules/connect-redis" ] || npm install connect-redis
fi
exec "$@"
fi