增加ci/cd
Some checks failed
continuous-integration/drone Build is failing

This commit is contained in:
yaha 2023-04-04 11:33:53 +08:00
parent 6ff7cfddda
commit 3dd6c2642f
4 changed files with 48 additions and 2 deletions

25
deploy.sh Normal file
View File

@ -0,0 +1,25 @@
#!/bin/bash
EXEC_USER=work
su - ${EXEC_USER}
DEPLOY_PATH="/home/work/docker/memos"
folder_exists() {
if [ -d "$1" ]; then
echo "folder is exists${1}"
return 0
fi
echo "create folder ${1}"
mkdir -p ${1}
chown -R work:work ${1}
}
pack_docker() {
cp -rv docker-compose.yml ${1}
}
folder_exists ${DEPLOY_PATH}
folder_exists ${DEPLOY_PATH}/data
pack_docker ${DEPLOY_PATH}

11
.drone.yml Normal file
View File

@ -0,0 +1,11 @@
kind: pipeline
type: exec
name: MemosServ
steps:
- name: build
commands:
- sh deploy.sh
- name: start
commands:
- sh control.sh

10
control.sh Normal file
View File

@ -0,0 +1,10 @@
#!/bin/bash
DEPLOY_PATH="/home/work/docker/memos"
chown -R work:work ${DEPLOY_PATH}
EXEC_USER=work
su - ${EXEC_USER}
cd ${DEPLOY_PATH}
docker-compose up -d

View File

@ -4,6 +4,6 @@ services:
image: neosmemo/memos:latest
container_name: memos
volumes:
- ~/.memos/:/var/opt/memos
- /home/work/docker/memos:/var/opt/memos
ports:
- 5230:5230
- 8006:5230