Sha256: e27bdab39c4ed96d741027bb61947a687775275fcf8e3c3f4e2e0e8232d6523f

Contents?: true

Size: 1.04 KB

Versions: 5

Compression:

Stored size: 1.04 KB

Contents

#!/bin/bash -e

<% if options.swap -%>
<% if run_as_root? -%>
<% @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
<% unless run_as_root? -%>
  exec su rails $0 $@
fi
<% end -%>

<% end -%>
<% if options.prepare -%>
<% if procfile.size > 1 -%>
# If running the production procfile then create or migrate existing database
if [ "${*}" == "foreman start --procfile=Procfile.prod" ]; then
<% else -%>
# If running the rails server then create or migrate existing database
if [ "${*}" == "./bin/rails server" ]; then
<% end -%>
<% if options.precompile == "defer" -%>
  ./bin/rails assets:precompile
<% end -%>
  ./bin/rails <%= dbprep_command %>
fi

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

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

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
dockerfile-rails-1.2.5 lib/generators/templates/docker-entrypoint.erb
dockerfile-rails-1.2.4 lib/generators/templates/docker-entrypoint.erb
dockerfile-rails-1.2.3 lib/generators/templates/docker-entrypoint.erb
dockerfile-rails-1.2.2 lib/generators/templates/docker-entrypoint.erb
dockerfile-rails-1.2.1 lib/generators/templates/docker-entrypoint.erb