Refactor restart script: improve Docker container restart logic and update completion messages
This commit is contained in:
+7
-2
@@ -26,10 +26,15 @@ if ! command -v docker >/dev/null 2>&1; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Rebuilding and restarting app container using $COMPOSE_FILE..."
|
echo "Rebuilding and/or restarting app container using $COMPOSE_FILE..."
|
||||||
|
if [ -f "$SCRIPT_DIR/Dockerfile" ]; then
|
||||||
docker compose -f "$COMPOSE_FILE" up -d --build app
|
docker compose -f "$COMPOSE_FILE" up -d --build app
|
||||||
|
else
|
||||||
|
echo "Warning: Dockerfile not found in $SCRIPT_DIR. Skipping build and restarting existing app container."
|
||||||
|
docker compose -f "$COMPOSE_FILE" up -d --no-build app
|
||||||
|
fi
|
||||||
|
|
||||||
echo "Cleaning up unused Docker images..."
|
echo "Cleaning up unused Docker images..."
|
||||||
docker image prune -f
|
docker image prune -f
|
||||||
|
|
||||||
echo "App rebuild complete."
|
echo "App restart complete."
|
||||||
|
|||||||
Reference in New Issue
Block a user