I'm dockerizing a development environment, and I'd like to be able to livereload my modifications without having to rebuild the docker images. Because redis is one of my app's requirements, and I appreciate being able to link a redis container, I'm using docker compose.
In my docker-compose.yml, I have two containers defined:
node:
build: ./node
links:
- redis
ports:
- "8080"
env_file:
- node-app.env
redis:
image: redis
ports:
- "6379"
I've gone as far as adding a volume to my node app's dockerfile, but how do I mount the host's directory in the volume so that all of my live code updates are reflected in the container?
My current Dockerfile is as follows:
# Set the base image to Ubuntu
FROM node:boron
# File Author / Maintainer
MAINTAINER Amin Shah Gilani <amin@gilani.me>
# Install nodemon
RUN npm install -g nodemon
# Add a /app volume
VOLUME ["/app"]
# TODO: link the current . to /app
# Define working directory
WORKDIR /app
# Run npm install
RUN npm install
# Expose port
EXPOSE 8080
# Run app using nodemon
CMD ["nodemon", "/app/app.js"]
My project is like this:
/
- docker-compose.yml
- node-app.env
- node/
- app.js
- Dockerfile.js