Skip to content

Instantly share code, notes, and snippets.

@brunoluiz
Created November 28, 2017 22:06
Show Gist options
  • Save brunoluiz/b9532d644826d3a676177b26aad2264d to your computer and use it in GitHub Desktop.
Save brunoluiz/b9532d644826d3a676177b26aad2264d to your computer and use it in GitHub Desktop.
medium-botframework-part1-dockerconfigs
version: '2'
services:
app:
image: brunoluiz/pru-bot
env_file: .env.development
build:
args:
- NODE_ENV=development
context: .
volumes:
- .:/opt/app
- dummy:/opt/app/node_modules # Use the container's node_modules instead of the host's
ports:
- 80:80
- 9229:9229
command: ../node_modules/.bin/nodemon -L ./app.js --inspect=0.0.0.0:9229
volumes:
dummy:
FROM node:8.4.0
# Default NODE_ENV should be production (but it can be overwritten by a parameter)
ARG NODE_ENV=production
ENV NODE_ENV $NODE_ENV
# Default port should be 80 (but it can be overwritten by a parameter)
ARG PORT=80
ENV PORT $PORT
EXPOSE $PORT
# Install dependecies first, in a different folder (easier app bind mounting for local development)
WORKDIR /opt
COPY package.json /opt
RUN npm install && npm cache clean --force
# Allows access to the installed npm packages through the $PATH
ENV PATH /opt/node_modules/.bin:$PATH
# Finally, copy the application
WORKDIR /opt/app
COPY . /opt/app
CMD ["node", "app.js"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment