ci: docker: Wait for container to be healthy

pull/5467/head
Richard Hansen 2022-03-11 19:50:57 -05:00
parent 14a58fb9ba
commit 178db7508f
1 changed files with 10 additions and 2 deletions

View File

@ -39,9 +39,17 @@ jobs:
- -
name: Test name: Test
run: | run: |
docker run --rm -d -p 9001:9001 ${{ env.TEST_TAG }} docker run --rm -d -p 9001:9001 --name test ${{ env.TEST_TAG }}
./src/bin/installDeps.sh ./src/bin/installDeps.sh
sleep 3 while true; do
echo "Waiting for Docker container to start..."
status=$(docker container inspect -f '{{.State.Health.Status}}' test) || exit 1
case ${status} in
healthy) break;;
starting) sleep 2;;
*) printf %s\\n "unexpected status: ${status}" >&2; exit 1;;
esac
done
(cd src && npm run test-container) (cd src && npm run test-container)
git clean -dxf . git clean -dxf .
- -