Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Docs] Feedback for self-hosting/platform/docker-compose #4988

Open
AceDuan opened this issue Dec 12, 2024 · 1 comment
Open

[Docs] Feedback for self-hosting/platform/docker-compose #4988

AceDuan opened this issue Dec 12, 2024 · 1 comment
Labels
📝 Documentation Improvements or additions to documentation | 文档问题

Comments

@AceDuan
Copy link

AceDuan commented Dec 12, 2024

📝 Reference

https://github.com/lobehub/lobe-chat/tree/main/docs/self-hosting/platform/docker-compose.zh-CN.mdx

🐛 Feedback

Your response
想问下该如何在使用docker compose的情况下,更新镜像。

@lobehubbot
Copy link
Member

👀 @AceDuan

Thank you for raising an issue. We will investigate into the matter and get back to you as soon as possible.
Please make sure you have given us as much context as possible.
非常感谢您提交 issue。我们会尽快调查此事,并尽快回复您。 请确保您已经提供了尽可能多的背景信息。

@dosubot dosubot bot added the 📝 Documentation Improvements or additions to documentation | 文档问题 label Dec 12, 2024
Copy link

dosubot bot commented Dec 12, 2024

Hey @AceDuan! I'm here to assist you with any bugs, questions, or contributions you have. Let's tackle this issue together!

To update the Docker image when using Docker Compose, you can use the following script, which automates the process:

#!/bin/bash
# auto-update-lobe-chat.sh

# Set proxy (optional)
export https_proxy=http://127.0.0.1:7890 http_proxy=http://127.0.0.1:7890 all_proxy=socks5://127.0.0.1:7890

# Pull the latest image and store the output in a variable
output=$(docker pull lobehub/lobe-chat:latest 2>&1)

# Check if the pull command was executed successfully
if [ $? -ne 0 ]; then
  exit 1
fi
# Check if the output contains a specific string
echo "$output" | grep -q "Image is up to date for lobehub/lobe-chat:latest"

# If the image is already up to date, do nothing
if [ $? -eq 0 ]; then
  exit 0
fi

echo "Detected Lobe-Chat update"

# Remove the old container
echo "Removed: $(docker rm -f Lobe-Chat)"

# You may need to navigate to the directory where `docker-compose.yml` is located first
# cd /path/to/docker-compose-folder

# Run the new container
echo "Started: $(docker-compose up -d)"

# Print the update time and version
echo "Update time: $(date)"
echo "Version: $(docker inspect lobehub/lobe-chat:latest | grep 'org.opencontainers.image.version' | awk -F'"' '{print $4}')"

# Clean up unused images
docker images | grep 'lobehub/lobe-chat' | grep -v 'lobehub/lobe-chat-database' | grep -v 'latest' | awk '{print $3}' | xargs -r docker rmi > /dev/null 2>&1
echo "Removed old images."

This script pulls the latest Docker image, checks if an update is available, removes the old container, and starts a new one with the updated image. You can also set this script to run automatically using Crontab. Ensure that your Crontab can find the correct Docker command, and it is recommended to use absolute paths. Configure Crontab to execute the script every 5 minutes:

*/5 * * * * /path/to/auto-update-lobe-chat.sh >> /path/to/auto-update-lobe-chat.log 2>&1

This approach ensures that your Lobe Chat deployment remains up-to-date with minimal manual intervention [1][2].

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Other

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
📝 Documentation Improvements or additions to documentation | 文档问题
Projects
None yet
Development

No branches or pull requests

2 participants