Added dedicated entrypoint

This commit is contained in:
Pavel Pivovarov
2021-03-17 17:47:01 +11:00
parent a5b17cd47e
commit bc33308223
2 changed files with 19 additions and 1 deletions

View File

@@ -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"]

17
entrypoint.sh Normal file
View File

@@ -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