Dockerfile successfully building ping endpoint

This commit is contained in:
Evan Morikawa 2016-07-06 16:22:32 -07:00
parent f14443a83e
commit 3820521d62
3 changed files with 49 additions and 24 deletions

6
.dockerignore Normal file
View file

@ -0,0 +1,6 @@
.git
.gitignore
README.md
Procfile*
*node_modules*
docs

View file

@ -1,9 +1,20 @@
# Use the latest Node 6 base docker image
# https://github.com/nodejs/docker-node
FROM node:6
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app
COPY package.json /usr/src/app/
# Copy everything (excluding what's in .dockerignore) into an empty dir
COPY . /home
WORKDIR /home
RUN npm install
COPY . /usr/src/app
EXPOSE 8080
# This will do an `npm install` for each of our modules and then link them
# all together. See more about Lerna here: https://github.com/lerna/lerna
RUN node_modules/.bin/lerna bootstrap
# External services run on port 5100. Expose it.
EXPOSE 5100
# We use a start-aws command that automatically spawns the correct process
# based on environment variables (which changes instance to instance)
CMD [ "npm", "run", "start-aws"]

View file

@ -31,30 +31,38 @@ const plugins = [Inert, Vision, HapiBasicAuth, HapiBoom, {
}];
let sharedDb = null;
const {DatabaseConnector, SchedulerUtils} = require(`nylas-core`)
DatabaseConnector.forShared().then((db) => {
sharedDb = db;
});
const validate = (request, username, password, callback) => {
const {AccountToken} = sharedDb;
const {DatabaseConnector, SchedulerUtils} = require(`nylas-core`);
AccountToken.find({
where: {
value: username,
},
}).then((token) => {
if (!token) {
callback(null, false, {});
return
}
token.getAccount().then((account) => {
if (!account) {
let getSharedDb = null;
if (sharedDb) {
getSharedDb = Promise.resolve(sharedDb)
} else {
getSharedDb = DatabaseConnector.forShared()
}
getSharedDb.then((db) => {
sharedDb = db;
const {AccountToken} = db;
AccountToken.find({
where: {
value: username,
},
}).then((token) => {
if (!token) {
callback(null, false, {});
return;
return
}
SchedulerUtils.markAccountIsActive(account.id)
callback(null, true, account);
token.getAccount().then((account) => {
if (!account) {
callback(null, false, {});
return;
}
SchedulerUtils.markAccountIsActive(account.id)
callback(null, true, account);
});
});
});
};