Skip to content

Commit

Permalink
Add healthcheck
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanwi committed Sep 30, 2023
1 parent 16cec22 commit 0c592ef
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ jobs:
- name: Check Health
run: |
HEALTH_STATUS=$(docker inspect --format='{{.State.Status}}' rails-on-docker);
HEALTH_STATUS=$(docker inspect --format='{{.State.Health}}' rails-on-docker);
echo "$HEALTH_STATUS"
if [ "$HEALTH_STATUS" != "running" ]; then
if [ "$HEALTH_STATUS" != "healthy" ]; then
exit 1
fi
3 changes: 3 additions & 0 deletions production.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@ USER rails:rails
# Entrypoint prepares the database.
ENTRYPOINT ["/rails/bin/docker-entrypoint-production"]

HEALTHCHECK --interval=5m --timeout=3s --start-period=30s \
CMD curl -f http://localhost:3000/up || exit 1

# Start the server by default, this can be overwritten at runtime
EXPOSE 3000
CMD ["./bin/rails", "server"]

0 comments on commit 0c592ef

Please sign in to comment.