heroku / docker-ruby

Ruby image for the heroku-docker project
17 stars 30 forks source link

HELP: web_1 | Could not locate Gemfile or .bundle/ directory #13

Open 3den opened 8 years ago

3den commented 8 years ago

I created a new rails 5 app but i am getting this error (web_1 | Could not locate Gemfile or .bundle/ directory) every time I run docker-compose up web... The Gemfile is on the root of my app, and both the Dockerfile and docker-compose.yml are the defaults generate by heroku docker:init.

Thanks in advance :)

paulodiovani commented 8 years ago

I think this is not an app bug, most probably a misconfiguration and would be better asked on Stackoverflow.

But please, paste the output so we can check.

jmardjuki commented 8 years ago

I'm having the same problem

This is my output

$ docker-compose up web
rubygettingstarted_herokuPostgresql_1 is up-to-date
Starting rubygettingstarted_web_1
Attaching to rubygettingstarted_web_1
web_1 | Could not locate Gemfile or .bundle/ directory
rubygettingstarted_web_1 exited with code 10
acrogenesis commented 8 years ago

Dockerfile

FROM heroku/cedar:14
MAINTAINER Terence Lee <terence@heroku.com>

RUN mkdir -p /app/user
WORKDIR /app/user

ENV GEM_PATH /app/heroku/ruby/bundle/ruby/2.3.0
ENV GEM_HOME /app/heroku/ruby/bundle/ruby/2.3.0
RUN mkdir -p /app/heroku/ruby/bundle/ruby/2.3.0

# Install Ruby
RUN mkdir -p /app/heroku/ruby/ruby-2.3.1
RUN curl -s --retry 3 -L https://heroku-buildpack-ruby.s3.amazonaws.com/cedar-14/ruby-2.3.1.tgz | tar xz -C /app/heroku/ruby/ruby-2.3.1
ENV PATH /app/heroku/ruby/ruby-2.3.1/bin:$PATH

# Install Node
RUN curl -s --retry 3 -L http://s3pository.heroku.com/node/v0.12.7/node-v0.12.7-linux-x64.tar.gz | tar xz -C /app/heroku/ruby/
RUN mv /app/heroku/ruby/node-v0.12.7-linux-x64 /app/heroku/ruby/node-0.12.7
ENV PATH /app/heroku/ruby/node-0.12.7/bin:$PATH

# Install Bundler
RUN gem install bundler -v 1.12.3 --no-ri --no-rdoc
ENV PATH /app/user/bin:/app/heroku/ruby/bundle/ruby/2.3.0/bin:$PATH
ENV BUNDLE_APP_CONFIG /app/heroku/ruby/.bundle/config

# Run bundler to cache dependencies
ONBUILD COPY ["Gemfile", "Gemfile.lock", "/app/user/"]
ONBUILD RUN bundle install --path /app/heroku/ruby/bundle --jobs 4
ONBUILD ADD . /app/user

# How to conditionally `rake assets:precompile`?
ONBUILD ENV RAILS_ENV production
ONBUILD ENV SECRET_KEY_BASE $(openssl rand -base64 32)
ONBUILD RUN bundle exec rake assets:precompile

# export env vars during run time
RUN mkdir -p /app/.profile.d/
RUN echo "cd /app/user/" > /app/.profile.d/home.sh
ONBUILD RUN echo "export PATH=\"$PATH\" GEM_PATH=\"$GEM_PATH\" GEM_HOME=\"$GEM_HOME\" RAILS_ENV=\"\${RAILS_ENV:-$RAILS_ENV}\" SECRET_KEY_BASE=\"\${SECRET_KEY_BASE:-$SECRET_KEY_BASE}\" BUNDLE_APP_CONFIG=\"$BUNDLE_APP_CONFIG\"" > /app/.profile.d/ruby.sh

COPY ./init.sh /usr/bin/init.sh
RUN chmod +x /usr/bin/init.sh

ENTRYPOINT ["/usr/bin/init.sh"]

docker-compose.yml

web:
  build: .
  command: 'bash -c ''bundle exec puma -C config/puma.rb'''
  working_dir: /app/user
  environment:
    PORT: 8080
    DATABASE_URL: 'postgres://postgres:@herokuPostgresql:5432/postgres'
  ports:
    - '8080:8080'
  links:
    - herokuPostgresql
shell:
  build: .
  command: bash
  working_dir: /app/user
  environment:
    PORT: 8080
    DATABASE_URL: 'postgres://postgres:@herokuPostgresql:5432/postgres'
  ports:
    - '8080:8080'
  links:
    - herokuPostgresql
  volumes:
    - '.:/app/user'
herokuPostgresql:
  image: postgres

I get the same error