Truly eager to get this rails docker dev workflow down. I bought PragProg’s ‘Docker for Rails Developers’ some years back and still struggle to make any real repetitive progress developing in rails this way.
Perhaps some contribution here, above it’s mentioned permissions have to change, although I think this step needs to be switched otherwise the docker build command will not run.
Also; currently docker-compose up fails with
- bundler: failed to load command: rails GemNotFound public_suffix-4.0.6 in any of the sources`
UPDATE: spent some time today getting to the bottom of this, if I may might I suggest the following edits: -
For Dockerfile
FROM ruby:2.5
RUN apt-get update -qq && apt-get install -y nodejs postgresql-client
WORKDIR /myapp
COPY Gemfile /myapp/Gemfile
COPY Gemfile.lock /myapp/Gemfile.lock
RUN bundle install
COPY . .
# run this every time container starts.
COPY entrypoint.sh /usr/bin/
RUN chmod +x /usr/bin/entrypoint.sh
ENTRYPOINT ["entrypoint.sh"]
EXPOSE 3000
# Configure the main process to run when running the image
CMD ["rails", "server", "-b", "0.0.0.0"]
#!/bin/bash
set -e
# Remove a potentially pre-existing server.pid for Rails.
rm -f /myapp/tmp/pids/server.pid
# Then exec the container's main process (what's set as CMD in the Dockerfile).
exec "$@"
Truly eager to get this rails docker dev workflow down. I bought PragProg’s ‘Docker for Rails Developers’ some years back and still struggle to make any real repetitive progress developing in rails this way.
Perhaps some contribution here, above it’s mentioned permissions have to change, although I think this step needs to be switched otherwise the docker build command will not run.
Also; currently
docker-compose up
fails withUPDATE: spent some time today getting to the bottom of this, if I may might I suggest the following edits: -
For
Dockerfile
For
docker-compose.yml
Not forgetting
entrypoint.sh
Thanks for the report, I will review the article to fix possible issues.