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

View File

@@ -1,5 +1,5 @@
#!/bin/bash #!/bin/bash
install_dokploy() {
if [ "$(id -u)" != "0" ]; then if [ "$(id -u)" != "0" ]; then
echo "This script must be run as root" >&2 echo "This script must be run as root" >&2
exit 1 exit 1
@@ -11,7 +11,6 @@ if [ "$(uname)" = "Darwin" ]; then
exit 1 exit 1
fi fi
# check if is running inside a container # check if is running inside a container
if [ -f /.dockerenv ]; then if [ -f /.dockerenv ]; then
echo "This script must be run on Linux" >&2 echo "This script must be run on Linux" >&2
@@ -109,4 +108,23 @@ echo ""
printf "${GREEN}Congratulations, Dokploy is installed!${NC}\n" printf "${GREEN}Congratulations, Dokploy is installed!${NC}\n"
printf "${BLUE}Wait 15 seconds for the server to start${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" 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