diff --git a/backup.sh b/backup.sh new file mode 100644 index 0000000..d86d6dc --- /dev/null +++ b/backup.sh @@ -0,0 +1,15 @@ +#!/bin/bash +# 自动备份时使用以下命令 +# /bin/bash /srv/dev-disk-by-label-hd2/docker/gitea/backup.sh + +cd $(dirname ${BASH_SOURCE:-$0}) + +cid=$(docker-compose ps -q gitea) +if [ ${#cid} -gt 0 ]; then + echo "Backuping applications ..." + docker-compose exec -T gitea /bin/bash -c "cd /app/gitea/backup; su git -c \"gitea dump\"" + exit 0 +else + echo "The container \"gitea\" not running. Please start container \"gitea\"" + exit 1 +fi \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index cc8429f..e03bbc1 100755 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -5,7 +5,7 @@ networks: external: false services: - server: + gitea: image: gitea/gitea:latest environment: - APP_NAME='通技的 gitea 服务器' @@ -27,7 +27,7 @@ services: - gitea volumes: - ./data/gitea:/data - - ./data/backup:/backup + - ./data/backup:/app/gitea/backup ports: - "3000:3000" - "22:22"