Skip to content
This repository has been archived by the owner on Feb 1, 2019. It is now read-only.

Commit

Permalink
Merge pull request #103 from cfpb/streamline-dockerfiles
Browse files Browse the repository at this point in the history
Add data to container during build rather than run
  • Loading branch information
hkeeler committed Oct 7, 2015
2 parents 1aefd36 + dbace3e commit 4d98737
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 10 deletions.
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Vim stuff
*.swp
*.swo

# Logs
logs
*.log
Expand Down Expand Up @@ -38,4 +42,4 @@ dist
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git-
node_modules

docs/*
docs/*
2 changes: 1 addition & 1 deletion data/laraggregates.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ var getData = function (activityYear) {
});
}

var dataURI = 'https://api.consumerfinance.gov/data/hmda/slice/hmda_lar.json?&$where=as_of_year=';
var dataURI = 'http://api.consumerfinance.gov/data/hmda/slice/hmda_lar.json?&$where=as_of_year=';
var roughLARData = {};
var finalLARCollection;
var activityYears = ['2012', '2013'];
Expand Down
1 change: 0 additions & 1 deletion data/reload_mongo.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ var insertData = function(key, docs) {
});
return deferred.promise;
};

var HOST = ENV_HOST || config.mongoConfig.host || '127.0.0.1';
var PORT = ENV_PORT || config.mongoConfig.port || '21717';
var DB = config.mongoConfig.database || 'hmda';
Expand Down
6 changes: 3 additions & 3 deletions mongo-docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ ENV NODE_ENV=production
COPY mongo-docker /tmp

# Build
RUN /tmp/run.sh && rm /tmp/run.sh
RUN /tmp/run.sh

# Tests
RUN /tmp/tests.sh && rm /tmp/tests.sh
RUN /tmp/tests.sh

# Install app
COPY . /usr/local/app
RUN /tmp/install-app.sh && rm /tmp/install-app.sh
RUN /tmp/install-app.sh

ENTRYPOINT ["/tmp/entrypoint.sh"]

Expand Down
2 changes: 0 additions & 2 deletions mongo-docker/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#!/bin/bash

/tmp/reload.sh&

set -e

if [ "${1:0:1}" = '-' ]; then
Expand Down
8 changes: 7 additions & 1 deletion mongo-docker/install-app.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
#!/bin/sh
#!/bin/bash

apk --update add make g++ python git

# Install app deps
cd /usr/local/app
npm install

# Start mongo
mongod --smallfiles&

/tmp/reload.sh
kill %%

# Clean
apk del make g++ git python
rm -rf /var/cache/apk/*
2 changes: 1 addition & 1 deletion mongo-docker/reload.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

# Wait for mongod to start
sleep 10
sleep 5

node /usr/local/app/data/reload_mongo.js

0 comments on commit 4d98737

Please sign in to comment.