From 816ce5b782eb8ed59d51b942828b69aea567a25c Mon Sep 17 00:00:00 2001 From: Sabe Jones Date: Wed, 9 Dec 2015 16:23:47 -0500 Subject: [PATCH 1/2] feat(Docker): overhauled Dockerfile --- Dockerfile | 60 ++++++++++++++++++++++++++---------------------------- 1 file changed, 29 insertions(+), 31 deletions(-) diff --git a/Dockerfile b/Dockerfile index 42573acb10..4d5df5ba6c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,41 +1,39 @@ FROM ubuntu:trusty -MAINTAINER Thibault Cohen +MAINTAINER Sabe Jones -ENV DEBIAN_FRONTEND noninteractive - -### Init +# Avoid ERROR: invoke-rc.d: policy-rc.d denied execution of start. +RUN echo "#!/bin/sh\nexit 0" > /usr/sbin/policy-rc.d +# Install prerequisites RUN apt-get update +RUN apt-get install -y \ + build-essential \ + curl \ + git \ + libkrb5-dev \ + python -### Utils +# Install NodeJS +RUN curl -sL https://deb.nodesource.com/setup_4.x | sudo -E bash - +RUN apt-get install -y nodejs -RUN apt-get install -y git vim graphicsmagick nodejs phantomjs npm pkgconf libcairo2-dev libjpeg8-dev +# Clean up package management +RUN apt-get clean +RUN rm -rf /var/lib/apt/lists/* -### Installation +# Clone Habitica repo and install dependencies +RUN git clone https://github.com/HabitRPG/habitrpg.git +RUN npm install -g gulp grunt-cli bower +RUN cd /habitrpg && npm install +RUN cd /habitrpg && bower install --allow-root -RUN cd /opt && git clone https://github.com/HabitRPG/habitrpg.git +# Create environment config file and build directory +RUN cd /habitrpg && cp config.json.example config.json +RUN cd /habitrpg && sed -i 's/localhost/0.0.0.0/g' config.json # CHANGE IP TO MONGO CONTAINER IP +RUN mkdir -p /habitrpg/website/build -#RUN cd /opt/habitrpg && git checkout -t origin/develop - -RUN cd /opt/habitrpg && git pull - -RUN cd /opt/habitrpg && npm install -g grunt-cli bower nodemon - -RUN ln -s /usr/bin/nodejs /usr/bin/node - -RUN cd /opt/habitrpg && npm install - -# Add config file - -ADD ./config.json /opt/habitrpg/ - -RUN mkdir -p /opt/habitrpg/build - -RUN cd /opt/habitrpg && bower install --allow-root - -# Run server - -RUN cd /opt/habitrpg && grunt build:prod - -CMD cd /opt/habitrpg && grunt nodemon +# Start Habitica +EXPOSE 3000 +WORKDIR /habitrpg/ +CMD ["npm", "start"] From 1bd9582b2c462dbdfdcd06762d881475cbfbf418 Mon Sep 17 00:00:00 2001 From: Sabe Jones Date: Wed, 9 Dec 2015 16:32:39 -0500 Subject: [PATCH 2/2] refactor(Dockerfile): more readable comments re IP --- Dockerfile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 4d5df5ba6c..fa9accc94a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -30,9 +30,11 @@ RUN cd /habitrpg && bower install --allow-root # Create environment config file and build directory RUN cd /habitrpg && cp config.json.example config.json -RUN cd /habitrpg && sed -i 's/localhost/0.0.0.0/g' config.json # CHANGE IP TO MONGO CONTAINER IP RUN mkdir -p /habitrpg/website/build +# Point config.json to Mongo instance. Edit the IP address to your running Mongo container's IP before running. +RUN cd /habitrpg && sed -i 's/localhost/0.0.0.0/g' config.json + # Start Habitica EXPOSE 3000 WORKDIR /habitrpg/