Skip to content

Commit

Permalink
test for container healty
Browse files Browse the repository at this point in the history
  • Loading branch information
enricofer committed Jun 13, 2024
1 parent 181b897 commit a1d9f68
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ jobs:
- name: DEPLOY
run: docker compose up -d

- name: CHECK HEALTY
run: timeout 60s sh -c 'until docker ps | grep djakart-webapp_djakart | grep -q healthy; do echo "Waiting for container to be healthy..."; sleep 2; done'

- name: STOP
run: docker compose down

Expand Down
2 changes: 1 addition & 1 deletion build_webapp/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# docker build --build-context webapp_root=./webapp -t djakart:latest ./build_webapp
# docker build --build-context webapp_root=./webapp -t enricofer/djakart:latest ./build_webapp
FROM debian:bookworm-slim
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
Expand Down
6 changes: 6 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@ services:
- ./media:/media
- ./webapp:/app
- ./kart_versions:/kart_versions
healthcheck:
test: curl --fail http://localhost/healthcheck/ || exit 1
start_period: 60s
interval: 60s
timeout: 10s
retries: 10

postgis_djakart:
image: postgis/postgis:latest
Expand Down
2 changes: 2 additions & 0 deletions webapp/main_app/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@
"""
from django.contrib import admin
from django.urls import path, include, re_path
from django.http import HttpResponse

urlpatterns = [
path('admin/', admin.site.urls),
re_path(r'^djakart/', include('djakart.urls')),
re_path(r'^healthcheck/', lambda r: HttpResponse())
]

0 comments on commit a1d9f68

Please sign in to comment.