From e21856f783f49ec3776d3de83ad3ceeb238687dc Mon Sep 17 00:00:00 2001 From: Sam Ruby Date: Sat, 16 Sep 2023 13:21:57 -0400 Subject: [PATCH] Consistency/semantics: BUN_VERSION vs bun-v 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. --- railties/lib/rails/generators/app_base.rb | 2 +- railties/lib/rails/generators/rails/app/templates/Dockerfile.tt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/railties/lib/rails/generators/app_base.rb b/railties/lib/rails/generators/app_base.rb index b8fd673d151bd..1fb36edc8fab9 100644 --- a/railties/lib/rails/generators/app_base.rb +++ b/railties/lib/rails/generators/app_base.rb @@ -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 diff --git a/railties/lib/rails/generators/rails/app/templates/Dockerfile.tt b/railties/lib/rails/generators/rails/app/templates/Dockerfile.tt index ef6208ab104d4..e0e8f6f4d678a 100644 --- a/railties/lib/rails/generators/rails/app/templates/Dockerfile.tt +++ b/railties/lib/rails/generators/rails/app/templates/Dockerfile.tt @@ -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