-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathlaunch-docker.sh
executable file
·51 lines (42 loc) · 1.56 KB
/
launch-docker.sh
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
#!/bin/bash
set -e
# Define the container name
CONTAINER_NAME="logseqXR"
echo $CONTAINER_NAME
# Check if .env file exists
if [ ! -f .env ]; then
echo "Error: .env file not found. Please create a .env file with the necessary environment variables."
echo "You can use .env_template as a reference."
exit 1
fi
# Stop and remove existing container, including associated volumes
docker stop $CONTAINER_NAME >/dev/null 2>&1 || true
docker rm -v $CONTAINER_NAME >/dev/null 2>&1 || true
# Build the Docker image
echo "Building Docker image..."
if ! docker build -t logseq-xr-image .; then
echo "Docker build failed. Please check the error messages above."
exit 1
fi
# Ensure data/markdown directory exists
mkdir -p data/markdown
# Run the Docker container with GPU 0 enabled, correct environment variables, and volume mounts
echo "Running Docker container..."
if ! docker run -d \
--name $CONTAINER_NAME \
--gpus all \
-v "$(pwd)/data/markdown:/app/data/markdown" \
-v "$(pwd)/settings.toml:/app/settings.toml" \
-p 8443:8443 \
--env-file .env \
logseq-xr-image; then
echo "Failed to start Docker container. Please check the error messages above."
exit 1
fi
echo "Docker container is now running."
echo "Access the application at https://192.168.0.51:8443"
echo "WebSocket should be available at https://192.168.0.51:8443/ws"
echo "Note: You may see a security warning in your browser due to the self-signed certificate. This is expected for local development."
# Display container logs
echo "Container logs:"
docker logs -f $CONTAINER_NAME