ryanwi / rails7-on-docker

Working Rails 7 demo application running in Docker. No node.js or webpack required.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Trying to build for Production I encountered this error.

Altonymous opened this issue · comments

[+] Building 39.1s (13/14)
 => [internal] load build definition from production.Dockerfile                                                                                                                                                                          0.0s
 => => transferring dockerfile: 1.24kB                                                                                                                                                                                                   0.0s
 => [internal] load .dockerignore                                                                                                                                                                                                        0.0s
 => => transferring context: 429B                                                                                                                                                                                                        0.0s
 => [internal] load metadata for docker.io/library/ruby:3.1.2-slim                                                                                                                                                                       0.8s
 => [auth] library/ruby:pull token for registry-1.docker.io                                                                                                                                                                              0.0s
 => [internal] load build context                                                                                                                                                                                                        0.7s
 => => transferring context: 19.52MB                                                                                                                                                                                                     0.7s
 => CACHED [1/9] FROM docker.io/library/ruby:3.1.2-slim@sha256:ed50d5719f8ecd0bae4d26bc91672f130463d7be05b67433ab595af39da1a95d                                                                                                          0.0s
 => [2/9] RUN apt-get update -qq && apt-get install -yq --no-install-recommends     build-essential     gnupg2     libpq-dev   && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*                                                         16.4s
 => [3/9] RUN gem update --system && gem install bundler                                                                                                                                                                                 4.5s
 => [4/9] WORKDIR /usr/src/app                                                                                                                                                                                                           0.0s
 => [5/9] COPY Gemfile* ./                                                                                                                                                                                                               0.0s
 => [6/9] RUN bundle config frozen true  && bundle config jobs 4  && bundle config deployment true  && bundle config without 'development test'  && bundle install                                                                      16.8s
 => [7/9] COPY . .                                                                                                                                                                                                                       0.4s
 => ERROR [8/9] RUN bin/rails assets:clobber && bundle exec rails assets:precompile                                                                                                                                                      0.2s
------
 > [8/9] RUN bin/rails assets:clobber && bundle exec rails assets:precompile:
#13 0.175 /bin/sh: 1: bin/rails: not found
------
executor failed running [/bin/sh -c bin/rails assets:clobber && bundle exec rails assets:precompile]: exit code: 127

I checked the bin/ folder in the project and rails is definitely there.

I also verified that the file doesn't cause issues by running bin/rails c and it worked.

This does not appear to be an issue with this repository. It appears to be related to something I've done. Not sure what yet, but closing this due to the fact I can't reproduce it outside my application.

Update even though I can't reproduce outside my rails app.

I changed this line to:
RUN bundle exec rails assets:clobber && bundle exec rails assets:precompile
and it works.

I have no idea why a fresh checkout of this repo works without changing that line.. but my app the same code doesn't. but at least I've moved past it. Hopefully, my app's issue is not a symptom of something that will cause me other issues.

For those that might come across this on Google. Check out your .dockerignore file. Mine was excluding the bin directory.