-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
39b93cc
commit 8089fbd
Showing
1 changed file
with
26 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |