From 85c532fe8a31f22a3e8f24793db4caa515dfcb4a Mon Sep 17 00:00:00 2001 From: Matt Harrington Date: Sun, 3 Jan 2016 23:54:48 +0000 Subject: [PATCH 1/3] docker maintenance - removing broken sed (was also updating BASE_URL) in favor of NODE_DB_URI (will require documentation) - changing build order to reduce rebuilding some things unnecessarily - more effectively using WORKDIR to simplify commands --- Dockerfile | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/Dockerfile b/Dockerfile index fa9accc94a..618454c978 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,7 +3,7 @@ FROM ubuntu:trusty MAINTAINER Sabe Jones # Avoid ERROR: invoke-rc.d: policy-rc.d denied execution of start. -RUN echo "#!/bin/sh\nexit 0" > /usr/sbin/policy-rc.d +RUN echo -e '#!/bin/sh\nexit 0' > /usr/sbin/policy-rc.d # Install prerequisites RUN apt-get update @@ -22,20 +22,19 @@ RUN apt-get install -y nodejs RUN apt-get clean RUN rm -rf /var/lib/apt/lists/* -# Clone Habitica repo and install dependencies -RUN git clone https://github.com/HabitRPG/habitrpg.git +# Install global packages RUN npm install -g gulp grunt-cli bower -RUN cd /habitrpg && npm install -RUN cd /habitrpg && bower install --allow-root + +# Clone Habitica repo and install dependencies +WORKDIR /habitrpg +RUN git clone https://github.com/HabitRPG/habitrpg.git /habitrpg +RUN npm install +RUN bower install --allow-root # Create environment config file and build directory -RUN cd /habitrpg && cp config.json.example config.json -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 +RUN cp config.json.example config.json +RUN mkdir -p ./website/build # Start Habitica EXPOSE 3000 -WORKDIR /habitrpg/ CMD ["npm", "start"] From 67f184c0f4ca21077f2924120762e6a5e6cc88bb Mon Sep 17 00:00:00 2001 From: Matt Harrington Date: Mon, 4 Jan 2016 03:33:51 +0000 Subject: [PATCH 2/3] docker maintenance - added docker-compose.yml for quick one-command spinup - added docker-compose.dev.yml to override /habitrpg mount - modified Dockerfile to accept /habitrpg mount --- Dockerfile | 2 ++ docker-compose.dev.yml | 3 +++ docker-compose.yml | 13 +++++++++++++ 3 files changed, 18 insertions(+) create mode 100644 docker-compose.dev.yml create mode 100644 docker-compose.yml diff --git a/Dockerfile b/Dockerfile index 618454c978..1bcc66313e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -28,11 +28,13 @@ RUN npm install -g gulp grunt-cli bower # Clone Habitica repo and install dependencies WORKDIR /habitrpg RUN git clone https://github.com/HabitRPG/habitrpg.git /habitrpg +#RUN test -e /habitrpg || git clone https://github.com/HabitRPG/habitrpg.git /habitrpg RUN npm install RUN bower install --allow-root # Create environment config file and build directory RUN cp config.json.example config.json +#RUN test -e config.json || cp config.json.example config.json RUN mkdir -p ./website/build # Start Habitica diff --git a/docker-compose.dev.yml b/docker-compose.dev.yml new file mode 100644 index 0000000000..33216b0184 --- /dev/null +++ b/docker-compose.dev.yml @@ -0,0 +1,3 @@ +web: + volumes: + - '.:/habitrpg' diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000000..898000def7 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,13 @@ +web: + build: . + ports: + - "3000:3000" + links: + - mongo + environment: + - NODE_DB_URI=mongodb://mongo/habitrpg + +mongo: + image: mongo + ports: + - "27017:27017" From 1a1823bd4331477e09adc7f27e5c693b1a53890a Mon Sep 17 00:00:00 2001 From: Matt Harrington Date: Mon, 11 Jan 2016 05:17:20 +0000 Subject: [PATCH 3/3] fixup --- Dockerfile | 2 -- 1 file changed, 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 1bcc66313e..618454c978 100644 --- a/Dockerfile +++ b/Dockerfile @@ -28,13 +28,11 @@ RUN npm install -g gulp grunt-cli bower # Clone Habitica repo and install dependencies WORKDIR /habitrpg RUN git clone https://github.com/HabitRPG/habitrpg.git /habitrpg -#RUN test -e /habitrpg || git clone https://github.com/HabitRPG/habitrpg.git /habitrpg RUN npm install RUN bower install --allow-root # Create environment config file and build directory RUN cp config.json.example config.json -#RUN test -e config.json || cp config.json.example config.json RUN mkdir -p ./website/build # Start Habitica