Skip to content

Commit

Permalink
Updating entrypoint file
Browse files Browse the repository at this point in the history
  • Loading branch information
AlanMendicutti committed Aug 22, 2023
1 parent 39b93cc commit 8089fbd
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions bin/entrypoint
Original file line number Diff line number Diff line change
@@ -1,3 +1,29 @@
#!/usr/bin/env ruby

# frozen_string_literal: true

# Entrypoint Script
#
# This scipt is executed by Docker on container start on release images (i.e.
# live environments)

def set_given_or_default_command
ARGV.concat %w[puma] if ARGV.empty?
end

def execute_given_or_default_command
exec(*ARGV)
end

def run_migrations
raise('Migrations failed') unless system('rails db:migrate')
end

def run_database_seeds
raise('Seeds failed') unless system('rails db:seed')
end

set_given_or_default_command
run_migrations
run_database_seeds
execute_given_or_default_command

0 comments on commit 8089fbd

Please sign in to comment.