Refactor pipeline script
This commit is contained in:
parent
6bb221cbce
commit
b005424aa9
1 changed files with 12 additions and 16 deletions
|
|
@ -79,22 +79,18 @@ steps:
|
|||
from_secret: ssh_key
|
||||
port: 2332
|
||||
script:
|
||||
- cd /home/mnisyif/docker-containers/mnisyif/frontend
|
||||
- VERSION=$(cat version.txt)
|
||||
- echo "Confirming deployment for version: $VERSION"
|
||||
- docker ps -a
|
||||
- if ! docker ps | grep -q frontend-$VERSION; then
|
||||
echo "Container failed to start"
|
||||
docker logs frontend-$VERSION
|
||||
exit 1
|
||||
fi
|
||||
- echo "Container is running, checking Nginx configuration..."
|
||||
- docker exec frontend-$VERSION nginx -t || { echo "Nginx configuration test failed"; exit 1; }
|
||||
- echo "Listing contents of /usr/share/nginx/html"
|
||||
- docker exec frontend-$VERSION ls -la /usr/share/nginx/html
|
||||
- echo "Listing contents of /usr/share/nginx/html/resumes"
|
||||
- docker exec frontend-$VERSION ls -la /usr/share/nginx/html/resumes || echo "Resumes directory not found"
|
||||
- echo "Checking HTTP response..."
|
||||
- echo "Verifying deployment..."
|
||||
# Verify the container is running
|
||||
- docker ps | grep frontend || { echo "Container failed to start"; exit 1; }
|
||||
# Display container logs
|
||||
- docker logs frontend
|
||||
# Test Nginx configuration
|
||||
- docker exec frontend nginx -t
|
||||
# Check Nginx process
|
||||
- docker exec frontend ps aux | grep nginx
|
||||
# Check contents of /usr/share/nginx/html in the container
|
||||
- docker exec frontend ls -la /usr/share/nginx/html
|
||||
# Perform a simple HTTP request to check if the server is responding
|
||||
- curl -I http://localhost:5173 || { echo "HTTP request failed"; exit 1; }
|
||||
- echo "Deployment confirmed successfully"
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue