diff --git a/.github/workflows/docker-test.yml b/.github/workflows/docker-test.yml index ac272915bc..bc5831b87c 100644 --- a/.github/workflows/docker-test.yml +++ b/.github/workflows/docker-test.yml @@ -30,20 +30,26 @@ jobs: run: | docker build -t jeedom:bullseye --build-arg DEBIAN=bullseye --build-arg DATABASE=1 . - name: run jeedom:bullseye and check - # build current image for bullseye and check it + # run current image for bullseye and check it run: | docker run -p 80:80 -d --rm --name jeedom_bullseye jeedom:bullseye - sleep 45 + until [ "`docker inspect -f {{.State.Health.Status}} jeedom_bullseye`" == "healthy" ]; do + echo "waiting container to be healthy..." + sleep 5; + done; docker exec jeedom_bullseye php sick.php - name: Build jeedom:bookworm # build current image for bookworm run: | docker build -t jeedom:bookworm --build-arg DEBIAN=bookworm --build-arg DATABASE=1 . - name: run jeedom:bookworm and check - # build current image for bookworm and check it + # run current image for bookworm and check it run: | docker run -p 81:80 -d --rm --name jeedom_bookworm jeedom:bookworm - sleep 45 + until [ "`docker inspect -f {{.State.Health.Status}} jeedom_bookworm`" == "healthy" ]; do + echo "waiting container to be healthy..." + sleep 5; + done; docker exec jeedom_bookworm php sick.php - name: Clean docker image diff --git a/Dockerfile b/Dockerfile index 37a75bffed..d0bcff2b03 100644 --- a/Dockerfile +++ b/Dockerfile @@ -62,6 +62,11 @@ RUN echo >${WEBSERVER_HOME}/initialisation WORKDIR ${WEBSERVER_HOME} EXPOSE 80 EXPOSE 443 + +# check if apache is running +HEALTHCHECK --interval=1m --timeout=3s --retries=5 --start-period=10s --start-interval=5s \ + CMD curl -f http://localhost/ || exit 1 + COPY --chown=root:root --chmod=550 install/OS_specific/Docker/init.sh /root/ COPY --chown=root:root --chmod=550 install/bashrc /root/.bashrc CMD ["bash", "/root/init.sh"]