fix Dockerfile and docker-compose.yml so that image will hopefully build correctly on travis

This commit is contained in:
Cassie Tarakajian 2018-08-10 17:11:04 -04:00
parent 8f912fe8ce
commit c4b676d754
3 changed files with 46 additions and 11 deletions

View file

@ -4,8 +4,8 @@ ENV APP_HOME=/usr/src/app \
RUN mkdir -p $APP_HOME
WORKDIR $APP_HOME
EXPOSE 8000
EXPOSE 80
EXPOSE 443
# EXPOSE 80
# EXPOSE 443
FROM base as development
ENV NODE_ENV development
@ -23,14 +23,16 @@ RUN npm run build
FROM base as production
ENV NODE_ENV=production
COPY package.json package-lock.json ./
COPY package.json package-lock.json index.js ./
RUN npm install --production
RUN npm rebuild node-sass
RUN npm install pm2 -g
# RUN npm install pm2 -g
# RUN npm install local-ssl-proxy
COPY index.js ecosystem.json ./
# COPY index.js ecosystem.json ./
COPY --from=build /usr/src/app/dist ./dist
# for reg production
CMD ["pm2-runtime", "ecosystem.json"]
CMD ["npm", "run", "start:prod"]
# for production with pm2
# CMD ["pm2-runtime", "ecosystem.json"]
# for testing ssl locally
# CMD npm run ssl-proxy && pm2-runtime ecosystem.json

View file

@ -12,6 +12,12 @@ services:
# restart: always
# env_file:
# - "$PWD/.env"
environment:
- MONGO_INITDB_ROOT_USERNAME
- MONGO_INITDB_ROOT_PASSWORD
- MONGO_INITDB_DATABASE
- MONGO_RW_USERNAME
- MONGO_RW_PASSWORD
nginx:
image: nginx:1.13
volumes:
@ -30,10 +36,37 @@ services:
# env_file:
# - "$PWD/.env"
environment:
- MONGO_URL=mongodb://mongo:27017/p5js-web-editor
- MONGO_HOSTNAME=mongo
# - API_URL=https://localhost/api
# - PORT=80
- API_URL
- MONGO_URL
- MONGO_NAME
- PORT
- SESSION_SECRET
- AWS_ACCESS_KEY
- AWS_SECRET_KEY
- S3_BUCKET
- AWS_REGION
- GITHUB_ID
- GITHUB_SECRET
- MAILGUN_DOMAIN
- MAILGUN_KEY
- EMAIL_SENDER
- EMAIL_VERIFY_SECRET_TOKEN
- S3_BUCKET_URL_BASE
- GG_EXAMPLES_USERNAME
- GG_EXAMPLES_PASS
- GG_EXAMPLES_EMAIL
- GOOGLE_ID
- GOOGLE_SECRET
- EXAMPLE_USER_EMAIL
- EXAMPLE_USER_PASSWORD
- MONGO_INITDB_ROOT_USERNAME
- MONGO_INITDB_ROOT_PASSWORD
- MONGO_INITDB_DATABASE
- MONGO_RW_USERNAME
- MONGO_RW_PASSWORD
- MONGO_HOSTNAME
- MONGO_PORT
- FORCE_TO_HTTPS
volumes:
- .:/opt/node/app
- /opt/node/app/node_modules

View file

@ -1 +1 @@
mongo admin -u $MONGO_INITDB_ROOT_USERNAME -p $MONGO_INITDB_ROOT_PASSWORD --eval "db.createUser({ user: '$MONGO_RW_USERNAME', pwd: '$MONGO_RW_PASSWORD', roles: [ { role: 'readWrite', db: '$MONGO_INITDB_DATABASE' }, { role: 'readWrite', db: 'sessions' }] })"
mongo $MONGO_INITDB_DATABASE -u $MONGO_INITDB_ROOT_USERNAME -p $MONGO_INITDB_ROOT_PASSWORD --authenticationDatabase admin --eval "db.createUser({ user: '$MONGO_RW_USERNAME', pwd: '$MONGO_RW_PASSWORD', roles: [ { role: 'readWrite', db: '$MONGO_INITDB_DATABASE' }, { role: 'readWrite', db: 'sessions' }] })"