-
Notifications
You must be signed in to change notification settings - Fork 27
Expand file tree
/
Copy pathrebuild.sh
More file actions
executable file
·37 lines (30 loc) · 1.07 KB
/
rebuild.sh
File metadata and controls
executable file
·37 lines (30 loc) · 1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/bin/bash
# Script to rebuild and restart the MarkItDown container
# Set variables
CONTAINER_NAME="markitdown-api"
IMAGE_NAME="markitdown-api"
PORT="8490"
echo "Rebuilding and restarting MarkItDown container..."
# Check if the container is running and stop it if it is
if [ "$(docker ps -q -f name=$CONTAINER_NAME)" ]; then
echo "Stopping running container..."
docker stop $CONTAINER_NAME
fi
# Remove the existing container if it exists
if [ "$(docker ps -aq -f name=$CONTAINER_NAME)" ]; then
echo "Removing existing container..."
docker rm $CONTAINER_NAME
fi
# Rebuild the image
echo "Building new Docker image..."
docker build -t $IMAGE_NAME:latest .
# Run the new container
echo "Starting new container..."
docker run -d --name $CONTAINER_NAME -p $PORT:$PORT $IMAGE_NAME
# Check if container started successfully
if [ "$(docker ps -q -f name=$CONTAINER_NAME)" ]; then
echo "Container successfully rebuilt and restarted."
echo "Service is available at http://localhost:$PORT"
else
echo "❌ Failed to start the container. Check Docker logs for details."
fi