-
Notifications
You must be signed in to change notification settings - Fork 58
/
Copy path.drone.yml
117 lines (103 loc) · 2.19 KB
/
.drone.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
kind: pipeline
type: docker
name: build
trigger:
event:
- push
branch:
- master
platform:
os: linux
arch: amd64
clone:
retries: 3
steps:
- name: build_project
image: node:18
volumes:
- name: cache
path: /drone/src/node_modules
environment:
MONGODB_URI:
from_secret: MONGODB_URI
CommentRepoId:
from_secret: CommentRepoId
CommentDiscussionCategoryId:
from_secret: CommentDiscussionCategoryId
CloudflareAnalyze:
from_secret: CloudflareAnalyze
commands:
- npm i -g pnpm
- pnpm i
- pnpm build
- name: build_docker
image: docker:26.0.1
volumes:
- name: docker
path: /var/run/docker.sock
environment:
APP_NAME: nuxt3-blog-app
IMAGE_NAME: nuxt3-blog:latest
MONGODB_URI:
from_secret: MONGODB_URI
commands:
- docker ps -q --filter "name=$APP_NAME" | xargs -r docker stop
- docker ps -aq --filter "name=$APP_NAME" | xargs -r docker rm
- docker images --filter "reference=$IMAGE_NAME" -q | xargs -r docker rmi
- docker build -t $IMAGE_NAME .
- >
docker run -d
--name=$APP_NAME
--restart=always
-e MONGODB_URI=$MONGODB_URI
-p 127.0.0.1:8451:3000
$IMAGE_NAME
volumes:
- name: cache
host:
path: /var/cache/drone-nuxt3-blog
- name: docker
host:
path: /var/run/docker.sock
---
kind: pipeline
type: docker
name: backup_img
trigger:
event:
- cron
cron:
- backup_img
platform:
os: linux
arch: amd64
clone:
retries: 3
steps:
- name: backup_img
image: node:18
volumes:
- name: cache
path: /drone/src/node_modules
- name: imgs
path: /drone/src/imgs
environment:
FILE_USER:
from_secret: FILE_USER
FILE_GROUP:
from_secret: FILE_GROUP
NB_PASSWD:
from_secret: NB_PASSWD
NB_IMG_REGEX:
from_secret: NB_IMG_REGEX
commands:
- npm i -g pnpm
- pnpm genimg
- pnpm downimg
volumes:
- name: cache
host:
path: /var/cache/drone-nuxt3-blog
- name: imgs
host:
path: /data/next-cloud/data/yunyuyuan/files/nuxt3-blog-imgs