diff --git a/Dockerfile b/Dockerfile index 6ceb44c..77f9957 100644 --- a/Dockerfile +++ b/Dockerfile @@ -33,4 +33,5 @@ RUN yarn install --check-files; bundle exec rake assets:precompile EXPOSE 3000 -CMD cd /app && rake 'db:migrate' && bundle exec rails server -b 0.0.0.0 +ENTRYPOINT ["/bin/bash"] +CMD ["/app/entrypoint.sh"] diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100644 index 0000000..8d1e987 --- /dev/null +++ b/entrypoint.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +DATABASE=${DATABASE:-db/database/snibox.sqlite3} + +if [ -f /app/tmp/pids/server.pid ] +then + rm -f /app/tmp/pids/server.pid +fi + +cd /app + +if [ ! -f $DATABASE ] +then + rake 'db:migrate' +fi + +bundle exec rails server -b 0.0.0.0 \ No newline at end of file