Explorar el Código

rework code for latest nodebb

Girish Ramakrishnan hace 9 años
padre
commit
7966d1008e
Se han modificado 2 ficheros con 13 adiciones y 12 borrados
  1. 6 3
      Dockerfile
  2. 7 9
      start.sh

+ 6 - 3
Dockerfile

@@ -5,12 +5,15 @@ ENV PATH /usr/local/node-4.2.1/bin:$PATH
 
 RUN mkdir -p /app/code
 WORKDIR /app/code
-RUN git clone -b v0.8.x https://github.com/NodeBB/NodeBB.git .
+RUN curl -L https://github.com/NodeBB/NodeBB/archive/v1.0.3.tar.gz | tar -xz --strip-components 1 -f -
+RUN npm install --production
+RUN rm -rf logs && ln -s /run/nodebb/logs /app/code/logs
 
-RUN npm install
+# usually the setup script installs this. keep in sync with src/install.js DATABASES/dependancies
+RUN npm install mongodb@~2.0.0 connect-mongo
 
 # these links will become valid after setup is run
-RUN rm -rf /app/code/config.json && ln -sf /app/data/config.json /app/code/config.json
+RUN rm -rf /app/code/config.json && ln -sf /run/nodebb/config.json /app/code/config.json
 
 ADD start.sh /app/code/start.sh
 

+ 7 - 9
start.sh

@@ -2,14 +2,11 @@
 
 set -eu
 
-export NODE_ENV=production
-
-if [[ -z "$(ls -A /app/data)" ]]; then
-    echo "First run"
-fi
-
-cd /app/code
+echo "Creating directories"
+mkdir -p /app/data/public/uploads /run/nodebb/logs
+chown -R cloudron:cloudron /app/data /run/nodebb
 
+# this will generate the config.json
 setup="{
     \"url\": \"https://${HOSTNAME}\",
     \"admin:username\": \"admin\",
@@ -25,5 +22,6 @@ setup="{
     \"mongo:database\": \"${MONGODB_DATABASE}\"
 }"
 
-node app --setup "${setup}"
-exec node app
+export NODE_ENV=production
+node /app/code/app --setup "${setup}"
+/usr/local/bin/gosu cloudron:cloudron node /app/code/loader.js --no-daemon