fly-apps / dockerfile-rails

Provides a Rails generator to produce Dockerfiles and related files.
MIT License
455 stars 38 forks source link

Order of `COPY` commands doesn't allow for Gemfile's `file` directive #76

Closed luizkowalski closed 6 months ago

luizkowalski commented 6 months ago

I'm trying to use ruby file: ".ruby-version" on my Gemfile so I just have one file to update Ruby's version but I noticed I can't deploy on Fly with this change, I get the error that .ruby-version does not exist.

I noticed that COPY --link Gemfile Gemfile.lock ./ happens before COPY . . so at the bundle install phase, .ruby-version file is not there yet. There are a couple of ways to fix this, either put COPY . . before running bundle (not great) or simply copy .ruby-version before (or with) copying gemfile/gemfile.lock, but there's a catch: not everyone will have this file (or maybe the file is in the gitignore/dockerignore list)

thinking if this could be fixed somehow. any ideas?