docker supported

This commit is contained in:
rainerosion 2023-05-09 20:52:31 +08:00
parent 61e08d0060
commit 72745885e0
3 changed files with 30 additions and 9 deletions

4
Dockerfile Normal file
View File

@ -0,0 +1,4 @@
FROM alpine:latest
LABEL authors="rainerosion@gmail.com"
COPY upcos /bin/upcos
ENTRYPOINT ["upcos"]

6
cos.go
View File

@ -38,8 +38,12 @@ func main() {
resume := &upyun.MemoryRecorder{}
// 若设置为 nil则为正常的分片上传
yun.SetRecorder(resume)
separator := "/"
for _, path := range fileList {
remotePath := remoteBasePath + "/" + path
if strings.HasPrefix(path, "/") {
separator = ""
}
remotePath := remoteBasePath + separator + path
err = yun.Put(&upyun.PutObjectConfig{
Path: remotePath,
LocalPath: path,

View File

@ -1,12 +1,25 @@
# drone plugins for upyun cos
## 参数说明
| 参数 | 说明 | 备注 |
| ---------------- |----------|--------|
| up_operator | 操作员名称 ||
| up_password | 操作员密码 ||
| up_bucket | bucket名称 | 服务名称 |
| local_base_path | 本地路径 | 文件或文件夹 |
| remote_base_path | 对象存储路径 | 文件夹 |
| 参数 | 说明 | 备注 |
| ---------------- |--------|-------------|
| up_operator | 操作员名称 | |
| up_password | 操作员密码 | |
| up_bucket | bucket | 服务名称 |
| local_base_path | 本地路径 | 文件或文件夹 |
| remote_base_path | 对象存储路径 | 文件存放路径(文件夹) |
## 使用方式
## 使用方式
````yaml
- name: upload-upyun
image: rainteam/upcos:latest
settings:
up_operator:
from_secret: up_operator
up_password:
from_secret: up_password
up_bucket:
from_bucket: up_bucket
local_base_path: wechatbot
remote_base_path: gitea/devops
````