I have setup a project with Rails following the Docker-compose quick start guide, however I’ve run into an issue where live code changes are not reflected in the app and can only be seen upon rebuilding it.
My Dockerfile is as follows:
FROM ruby:2.3.1 RUN apt-get update -qq && apt-get install -y build-essential libpq-dev nodejs RUN gem update RUN mkdir /myapp WORKDIR /myapp ADD Gemfile /myapp/Gemfile ADD Gemfile.lock /myapp/Gemfile.lock RUN bundle install ADD . /myapp
My docker-compose.yml is as follows:
version: '2' services: db: image: postgres environment: POSTGRES_DB: dev POSTGRES_USER: user POSTGRES_PASSWORD: password web: build: . command: bundle exec rails s -p 3000 -b '0.0.0.0' volumes: - .:/myapp ports: - "3000:3000" depends_on: - db
As far as I can tell, I’m mounting the volume correctly, so I’m not sure why it’s not working. Also, I’m not sure if my setup process is correct or not, but I’m simply running docker-compose build (if not built) followed by docker-compose up. This gets the app working, however code changes just don’t show up.
Any help would be greatly appreciated.