Update openpanel_docker.sh

This commit is contained in:
Stefan Pejcic 2024-11-05 18:31:01 +01:00 committed by GitHub
parent 9dc69da09f
commit d4cdb9b696
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,10 +1,16 @@
#!/bin/bash #!/bin/bash
IMAGE_NAME="openpanel:openpanel" IMAGE_NAME="openpanel"
REPOSITORY_IMG_NAME="openpanel/openpanel"
TAG="latest" TAG="latest"
echo "Stopping existing OpenPanel container"
cd /root && docker compose down openpanel
echo "Building the Docker image..." echo "Deleting existing image "
docker image rm $IMAGE_NAME:$TAG
echo "Building the image..."
cd /root/2083/ cd /root/2083/
docker build -t $IMAGE_NAME:$TAG . docker build -t $IMAGE_NAME:$TAG .
@ -16,19 +22,15 @@ fi
echo "Docker image built successfully." echo "Docker image built successfully."
echo "Starting container for testing..." echo "Starting container for testing..."
docker run -d --name test_openpanel_container -p 2083:2083 $IMAGE_NAME:$TAG cd /root && docker compose up -d openpanel
sleep 5 sleep 5
echo "Testing the Flask app..." echo "Testing the Flask app..."
curl -f http://localhost:2083 || { curl -f http://localhost:2083 || {
echo "Error: Flask app did not start correctly." echo "Error: Flask app did not start correctly."
docker rm -f test_openpanel_container cd /root && docker compose down openpanel
exit 1 exit 1
} }
echo "Flask app is running successfully in Docker." echo "Flask app is running successfully in Docker."
# Clean up
docker rm -f test_openpanel_container
echo "Cleaned up test container."