File size: 1,686 Bytes
fab8051
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/bin/bash

set -e

# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m'

echo -e "${GREEN}Setting up radextract with Docker${NC}"

# Check if Docker is running
if ! docker info >/dev/null 2>&1; then
    echo -e "${RED}Error: Docker is not running. Please start Docker Desktop.${NC}"
    exit 1
fi

# Check if env.list exists
if [ ! -f "env.list" ]; then
    echo -e "${RED}Error: env.list file not found!${NC}"
    echo "Please create env.list with your API keys and configuration."
    exit 1
fi

# Stop and remove existing container if it exists
echo -e "${YELLOW}Cleaning up existing containers...${NC}"
docker stop radiology-report-app 2>/dev/null || true
docker rm radiology-report-app 2>/dev/null || true

# Build the Docker image
echo -e "${YELLOW}Building Docker image...${NC}"
docker build -t radiology-report-app .

# Run the container
echo -e "${YELLOW}Starting application in Docker container...${NC}"
docker run -d \
    --name radiology-report-app \
    --env-file env.list \
    -p 7870:7870 \
    -v "$(pwd)/cache:/app/cache" \
    radiology-report-app

# Wait for the application to start
echo -e "${YELLOW}Waiting for application to start...${NC}"
sleep 5

# Check if the application is running
if curl -s http://localhost:7870/ >/dev/null; then
    echo -e "${GREEN}Application is running at http://localhost:7870/${NC}"
    echo ""
    echo "To view logs: docker logs -f radiology-report-app"
    echo "To stop: docker stop radiology-report-app"
    echo "To restart: docker restart radiology-report-app"
else
    echo -e "${RED}Application failed to start. Check logs with: docker logs radiology-report-app${NC}"
    exit 1
fi