feat: add update option

This commit is contained in:
Vincent Young 2024-09-28 15:06:20 -04:00 committed by GitHub
parent cb03b153ac
commit 7027f39c48
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,5 +1,5 @@
#!/bin/bash
install_dokploy() {
if [ "$(id -u)" != "0" ]; then
echo "This script must be run as root" >&2
exit 1
@ -11,7 +11,6 @@ if [ "$(uname)" = "Darwin" ]; then
exit 1
fi
# check if is running inside a container
if [ -f /.dockerenv ]; then
echo "This script must be run on Linux" >&2
@ -109,4 +108,23 @@ echo ""
printf "${GREEN}Congratulations, Dokploy is installed!${NC}\n"
printf "${BLUE}Wait 15 seconds for the server to start${NC}\n"
printf "${YELLOW}Please go to http://${formatted_addr}:3000${NC}\n\n"
echo ""
}
update_dokploy() {
echo "Updating Dokploy..."
# Pull the latest image
docker pull dokploy/dokploy:latest
# Update the service
docker service update --image dokploy/dokploy:latest dokploy
echo "Dokploy has been updated to the latest version."
}
# Main script execution
if [ "$1" = "update" ]; then
update_dokploy
else
install_dokploy
fi