Skip to content

Commit

Permalink
Consistency/semantics: BUN_VERSION vs bun-v
Browse files Browse the repository at this point in the history
All the other VERSION ARGS in the Dockerfile are pure version numbers.
Any other additions are handled elsewhere.

Arguably, this is just cosmetic/foolish consistency, but it is a source
of subtle bugs.  For example, the fallback if `bun -version` fails is
defined here:

https://github.com/rails/rails/blob/af1d77abfb0120fdeee23e36878fd97be7ff388f/railties/lib/rails/generators/app_base.rb#L19

Note the _lack_ of bun_v, which ultimately will cause the docker build
to fail.
  • Loading branch information
rubys committed Sep 16, 2023
1 parent af1d77a commit e21856f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion railties/lib/rails/generators/app_base.rb
Expand Up @@ -497,7 +497,7 @@ def dockerfile_yarn_version
end

def dockerfile_bun_version
using_bun? and "bun-v#{`bun --version`[/\d+\.\d+\.\d+/]}"
using_bun? and `bun --version`[/\d+\.\d+\.\d+/]
rescue
BUN_VERSION
end
Expand Down
Expand Up @@ -36,7 +36,7 @@ RUN curl -sL https://github.com/nodenv/node-build/archive/master.tar.gz | tar xz
ENV BUN_INSTALL=/usr/local/bun
ENV PATH=/usr/local/bun/bin:$PATH
ARG BUN_VERSION=<%= dockerfile_bun_version %>
RUN curl -fsSL https://bun.sh/install | bash -s -- "${BUN_VERSION}"
RUN curl -fsSL https://bun.sh/install | bash -s -- "bun-v${BUN_VERSION}"

<% end -%>
# Install application gems
Expand Down

0 comments on commit e21856f

Please sign in to comment.