Skip to content

Commit

Permalink
Added healthcheck to Dockerfile.
Browse files Browse the repository at this point in the history
  • Loading branch information
srtab committed Dec 7, 2024
1 parent c2f1956 commit c68d688
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 2 deletions.
2 changes: 2 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,5 @@ exclude_lines =
raise AssertionError
raise NotImplementedError
if TYPE_CHECKING
@abc.abstractmethod
@abstractmethod
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [0.1.0-rc.4] - 2024-12-07

### Added

- Added `HEALTHCHECK` to the `Dockerfile`.

### Fixed

- Fixed `Dockerfile` to create the `app` user with the correct home directory defined.
Expand Down
3 changes: 3 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,7 @@ WORKDIR /home/app

RUN python -m compileall daiv_sandbox

HEALTHCHECK --interval=10s \
CMD curl --fail http://127.0.0.1:8000/-/health/ || exit 1

CMD ["fastapi", "run", "daiv_sandbox/main.py", "--host", "0.0.0.0", "--port", "8000"]
4 changes: 2 additions & 2 deletions tests/test_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,12 +124,12 @@ def test_run_commands_with_workdir(MockSession, client): # noqa: N803


def test_health(client):
response = client.get("/health/")
response = client.get("/-/health/")
assert response.status_code == 200
assert response.json() == {"status": "ok"}


def test_version(client):
response = client.get("/version/")
response = client.get("/-/version/")
assert response.status_code == 200
assert response.json() == {"version": __version__}

0 comments on commit c68d688

Please sign in to comment.