Skip to content

Commit

Permalink
Add more docker scenarios
Browse files Browse the repository at this point in the history
  • Loading branch information
larose committed Jun 23, 2024
1 parent d07a0a9 commit 4f07b63
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -133,3 +133,11 @@ jobs:
exit 1;
fi;
"
- name: Nginx
run: source test/docker_nginx.sh

- name: Nginx with port forwarding
run: source test/docker_nginx_port_forwarding.sh

# docker run --detach --publish 8080:80 --name nginx-publish-port nginx:1.27
28 changes: 28 additions & 0 deletions test/docker_nginx.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/bin/bash

test() {
local retries=10
local nginx_container_ip
nginx_container_ip=$(docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' nginx)

echo "Nginx container IP: $nginx_container_ip"

for ((attempt = 1; attempt <= retries; attempt++)); do
echo "Attempt $attempt..."
if curl "http://$nginx_container_ip" >/dev/null; then
echo "Successfully connected to nginx container."
exit 0
else
echo "Connection attempt $attempt failed."
sleep 1
fi
done

echo "Failed to connect to nginx container."
exit 1
}

# Start nginx container in detached mode and name it 'nginx'
docker run --detach --name nginx nginx:1.27

test

0 comments on commit 4f07b63

Please sign in to comment.