Skip to content

Commit

Permalink
Merge pull request #122 from aidewoode/dev
Browse files Browse the repository at this point in the history
Fix error of can not found SECRET_KEY_BASE on worker
  • Loading branch information
aidewoode committed Jan 17, 2022
2 parents be7aab5 + 3375823 commit 54592e8
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ RUN bundle exec rails assets:precompile SECRET_KEY_BASE=fake_secure_for_compile

RUN cp config/nginx/nginx.conf /etc/nginx/nginx.conf

ENTRYPOINT ["docker/entrypoint.sh"]

EXPOSE 3000

CMD ["docker/production_start.sh"]
11 changes: 11 additions & 0 deletions docker/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/sh

if [ -z ${SECRET_KEY_BASE+x} ]; then
echo "Generating SECRET_KEY_BASE environment variable."
echo "Please attention, all old sessions will become invalid."
echo "You can set SECRET_KEY_BASE environment variable on docker service,"
echo "to avoid generate SECRET_KEY_BASE every time when service start up."
export SECRET_KEY_BASE=$(rails secret)
fi

exec "$@"
8 changes: 0 additions & 8 deletions docker/production_start.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
#!/bin/sh

if [ -z ${var+x} ]; then
echo "Generating SECRET_KEY_BASE environment variable."
echo "Please attention, all old sessions will become invalid."
echo "You can set SECRET_KEY_BASE environment variable on docker service,"
echo "to avoid generate SECRET_KEY_BASE every time when service start up."
export SECRET_KEY_BASE=$(rails secret)
fi

# Prepare Database
rails db:prepare

Expand Down

0 comments on commit 54592e8

Please sign in to comment.