Skip to content

Commit

Permalink
fix: test image
Browse files Browse the repository at this point in the history
  • Loading branch information
kutuzov13 committed May 30, 2024
1 parent 9ac5c72 commit f77d9c5
Showing 1 changed file with 5 additions and 23 deletions.
28 changes: 5 additions & 23 deletions .github/scripts/test_image
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,12 @@

set -ex

PROJECT_NAME=async-box-bot
PROJECT_NAME=bot-example

python -m copier --defaults . async-box-bot
docker build -t $PROJECT_NAME $PROJECT_NAME

# there should be added `--fail` option to curl command when healthcheck endpoint is added
docker run \
-d \
--name $PROJECT_NAME \
--network host \
-e APP_ENV=dev \
-e REDIS_DSN=$REDIS_DSN \
-e POSTGRES_DSN=$POSTGRES_DSN \
-e BOT_CREDENTIALS="cts.example.com@secret@aab1b617-7694-4e75-bc59-145a2fd1502f" \
--health-cmd "curl http://localhost:8000/status || exit 1" \
--health-interval 2s \
--health-start-period 4s \
--health-timeout 1s \
$PROJECT_NAME
python -m copier --defaults . $PROJECT_NAME
cd $PROJECT_NAME

docker-compose up -d
sleep 10

HEALTH_STATUS=$(docker inspect $PROJECT_NAME --format='{{.State.Health.Status}}')
if [[ $HEALTH_STATUS != healthy ]]; then
docker logs $PROJECT_NAME
exit 1
fi
curl --silent --fail http://localhost:8000/healthcheck || exit 1

0 comments on commit f77d9c5

Please sign in to comment.