@@ -2,9 +2,9 @@ name: Docker Image CI
22
33on :
44 push :
5- branches : [ "develop " ]
5+ branches : [ "main " ]
66 pull_request :
7- branches : [ "develop " ]
7+ branches : [ "main " ]
88
99jobs :
1010 build :
@@ -34,16 +34,14 @@ jobs:
3434
3535 - name : Run the application container
3636 run : |
37- docker run --name grandnode2-container -d -p 8080:8080 --user root -- link mongodb-container:mongo grandnode2:pr-latest
37+ docker run --name grandnode2-container -d -p 8080:8080 --link mongodb-container:mongo grandnode2:pr-latest
3838
3939 - name : Wait for the application to be ready
4040 run : |
4141 echo "Waiting for the application to start..."
4242 for i in {1..10}; do
4343 curl -s http://localhost:8080 && echo "Application is up!" && break
4444 echo "Retrying in 3 seconds..."
45- echo "Container logs:"
46- docker logs grandnode2-container --tail 20
4745 sleep 3
4846 done
4947
7270 run : |
7371 echo "Waiting for the application to start..."
7472 for i in {1..10}; do
75- RESPONSE=$(curl -s -o /dev/null -w "%{http_code}" -L http://localhost:8080 || echo "error")
73+ RESPONSE=$(curl -s -o /dev/null -w "%{http_code}" http://localhost:8080 || echo "error")
7674 if [ "$RESPONSE" = "200" ]; then
7775 echo "Application is up with HTTP 200 response!"
7876 exit 0
@@ -81,21 +79,12 @@ jobs:
8179 else
8280 echo "Received HTTP response code: $RESPONSE. Retrying in 3 seconds..."
8381 fi
84- echo "Container logs:"
85- docker logs grandnode2-container --tail 30
8682 sleep 3
8783 done
8884 echo "Application did not start successfully. Final response code: $RESPONSE"
8985 exit 1
90-
91- - name : Show container logs
92- run : |
93- echo "=== Full container logs ==="
94- docker logs grandnode2-container
95- echo "=== Container status ==="
96- docker inspect grandnode2-container --format='{{.State.Status}} - Exit: {{.State.ExitCode}}'
9786
9887 - name : Stop and remove the container
9988 run : |
10089 docker stop grandnode2-container
101- docker rm grandnode2-container
90+ docker rm grandnode2-container
0 commit comments