added ENV to Dockerfile, also deployment to circleci

This commit is contained in:
Danny Coates 2017-06-20 15:48:36 -07:00
parent 53f264e63b
commit f7c1b1718e
No known key found for this signature in database
GPG Key ID: 4C442633C62E00CB
5 changed files with 13 additions and 23 deletions

View File

@ -1,20 +0,0 @@
version: 2
jobs:
build:
working_directory: ~/app
docker:
- image: circleci/node:8
steps:
- checkout
- restore_cache:
key: dependency-cache-{{ checksum "package-lock.json" }}
- run:
name: npm-install
command: npm install
- save_cache:
key: dependency-cache-{{ checksum "package-lock.json" }}
paths:
- .node_modules
- run:
name: test
command: npm test

View File

@ -5,5 +5,7 @@ WORKDIR /app
RUN mkdir static RUN mkdir static
RUN npm install RUN npm install
EXPOSE 1443 ENV PORT=1443
EXPOSE $PORT
CMD ["npm", "start"] CMD ["npm", "start"]

View File

@ -2,3 +2,10 @@ machine:
node: node:
version: 8.0.0 version: 8.0.0
deployment:
latest:
branch: master
commands:
- docker login -e $DOCKER_EMAIL -u $DOCKER_USER -p $DOCKER_PASS
- docker build . -t mozilla/portal:latest
- docker push mozilla/portal:latest

View File

@ -1,9 +1,10 @@
Environment Variables: Environment Variables:
PORT - port the server will listen on (defaults to 1443)
P2P_S3_BUCKET - the S3 bucket name P2P_S3_BUCKET - the S3 bucket name
P2P_REDIS_HOST - host name of the redis server P2P_REDIS_HOST - host name of the redis server
NODE_ENV - production NODE_ENV - production
Example Example
docker run --net=host -e 'NODE_ENV=production' -e 'P2P_S3_BUCKET=testpilot-p2p-dev' -e 'P2P_REDIS_HOST=dyf9s2r4vo3.bolxr4.0001.usw2.cache.amazonaws.com' docker run --net=host -e 'NODE_ENV=production' -e 'P2P_S3_BUCKET=testpilot-p2p-dev' -e 'P2P_REDIS_HOST=dyf9s2r4vo3.bolxr4.0001.usw2.cache.amazonaws.com' mozilla/portal:latest

View File

@ -20,7 +20,7 @@ const conf = convict({
format: 'port', format: 'port',
default: 1443, default: 1443,
arg: 'port', arg: 'port',
env: 'P2P_LISTEN_PORT' env: 'PORT'
}, },
env: { env: {
format: ['production', 'development', 'test'], format: ['production', 'development', 'test'],