Sha256: a73f55ae6e37f79b8cda6aba07b8f19a2c79d1f59c3b567848c424e57e8078f4

Contents?: true

Size: 1.78 KB

Versions: 4

Compression:

Stored size: 1.78 KB

Contents

<% if options.alpine? -%>
#!/bin/sh -e
<% else -%>
#!/bin/bash -e
<% end -%>

<% if options.jemalloc? -%>
# Enable jemalloc for reduced memory usage and latency.
if [ -z "${LD_PRELOAD+x}" ]; then
    LD_PRELOAD=$(find /usr/lib -name libjemalloc.so.2 -print -quit)
    export LD_PRELOAD
fi

<% end -%>
<% if options.swap && !File.exist?("fly.toml")-%>
<% if run_as_root? or using_passenger? -%>
<% @space = "" -%>
<% else -%>
<% @space = "  " -%>
if [ $UID -eq 0 ]; then
<% end -%>
<%= @space %># allocate swap space
<%= @space %>fallocate -l <%= options.swap %> /swapfile
<%= @space %>chmod 0600 /swapfile
<%= @space %>mkswap /swapfile
<%= @space %>echo 10 > /proc/sys/vm/swappiness
<%= @space %>swapon /swapfile
<%= @space %>echo 1 > /proc/sys/vm/overcommit_memory
<% if using_litefs? -%>

<%= @space %># mount litefs
<%= @space %>litefs mount &
<% end -%>
<% unless run_as_root? or using_passenger? -%>

  exec su rails $0 $@
fi
<% end -%>

<% elsif using_litefs? -%>
# mount litefs
<% unless run_as_root? %>sudo -E <% end %>litefs mount &

<% end -%>
<% if options.prepare -%>
<% if !options.procfile.blank? -%>
# If running the specified procfile then create or migrate existing database
<% elsif procfile.size > 1 -%>
# If running the production procfile then create or migrate existing database
<% else -%>
# If running the rails server then create or migrate existing database
<% end -%>
if <%= start_command.map.with_index {|word, index| "[ \"${@: #{index - start_command.length}:1}\" == #{shellescape(word)} ]"}.join(" && ") %><% if using_litefs? %> && [ "$FLY_REGION" == "$PRIMARY_REGION" ]<%end%>; then
<% if options.precompile == "defer" -%>
  ./bin/rails assets:precompile
<% end -%>
  <%= dbprep_command %>
fi

<% elsif !options.swap -%>
# Add any container initialization steps here

<% end -%>
exec "${@}"

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
dockerfile-rails-1.7.3 lib/generators/templates/docker-entrypoint.erb
dockerfile-rails-1.7.2 lib/generators/templates/docker-entrypoint.erb
dockerfile-rails-1.7.1 lib/generators/templates/docker-entrypoint.erb
dockerfile-rails-1.7.0 lib/generators/templates/docker-entrypoint.erb