Skip to content

Commit

Permalink
extract workdir from Dockerfile, and skip [[statics]] if workdir cont…
Browse files Browse the repository at this point in the history
…ains a variable
  • Loading branch information
rubys committed Mar 17, 2024
1 parent f45d6c7 commit 484a55c
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/generators/dockerfile_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1311,9 +1311,11 @@ def fly_make_toml
end
end

# Add statics if not already present and not using a web server and workdir doesn't contain a variable
unless options.nginx? || using_passenger? || options.thruster? || @gemfile.include?("thruster")
unless toml.include? "[statics]"
toml += "[[statics]]\n guest_path = \"/rails/public\"\n url_prefix = \"/\"\n\n"
workdir = (IO.read 'Dockerfile' rescue '').scan(/^\s*WORKDIR\s+(\S+)/).flatten.last
unless workdir && !workdir.include?('$') && toml.include?("[statics]")
toml += "[[statics]]\n guest_path = \"#{workdir}/public\"\n url_prefix = \"/\"\n\n"
end
end

Expand Down

0 comments on commit 484a55c

Please sign in to comment.