This commit is contained in:
parent
8bcd3266d6
commit
e1902ad176
19
.drone.yml
Normal file
19
.drone.yml
Normal file
@ -0,0 +1,19 @@
|
||||
kind: pipeline
|
||||
type: docker
|
||||
name: wireguard-dashboard
|
||||
|
||||
trigger:
|
||||
event: [tag]
|
||||
|
||||
steps:
|
||||
- name: builder
|
||||
image: plugins/docker
|
||||
settings:
|
||||
registry: gitea.mrx.ltd # 镜像仓库地址
|
||||
repo: gitea.mrx.ltd/go-pkg/wireguard-dashboard # 镜像仓库地址
|
||||
username:
|
||||
from_secret: docker_user
|
||||
password:
|
||||
from_secret: docker_pwd
|
||||
use_cache: true
|
||||
auto_tag: true
|
21
Dockerfile
Normal file
21
Dockerfile
Normal file
@ -0,0 +1,21 @@
|
||||
FROM golang:alpine as build
|
||||
|
||||
WORKDIR /build
|
||||
|
||||
COPY . .
|
||||
|
||||
ENV GO111MODULE=on
|
||||
ENV GOPROXY=https://goproxy.cn,direct
|
||||
|
||||
RUN go mod download && go build -o app
|
||||
|
||||
RUN ls -lh && chmod +x ./app
|
||||
|
||||
FROM alpine
|
||||
|
||||
COPY --from=build /build/app /bin
|
||||
COPY --from=build /template/* /template/
|
||||
|
||||
RUN ls -al /bin/ | grep 'app'
|
||||
|
||||
ENTRYPOINT ["/bin/app"]
|
2
go.mod
2
go.mod
@ -17,6 +17,7 @@ require (
|
||||
golang.org/x/crypto v0.21.0
|
||||
golang.zx2c4.com/wireguard/wgctrl v0.0.0-20230429144221-925a1e7659e6
|
||||
gopkg.in/fsnotify.v1 v1.4.7
|
||||
gopkg.in/gomail.v2 v2.0.0-20160411212932-81ebce5c23df
|
||||
gopkg.in/yaml.v3 v3.0.1
|
||||
gorm.io/driver/mysql v1.5.4
|
||||
gorm.io/driver/postgres v1.5.6
|
||||
@ -98,6 +99,5 @@ require (
|
||||
google.golang.org/grpc v1.50.1 // indirect
|
||||
google.golang.org/protobuf v1.33.0 // indirect
|
||||
gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc // indirect
|
||||
gopkg.in/gomail.v2 v2.0.0-20160411212932-81ebce5c23df // indirect
|
||||
gopkg.in/yaml.v2 v2.4.0 // indirect
|
||||
)
|
||||
|
@ -2,6 +2,7 @@ package utils
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"gitee.ltd/lxh/logger/log"
|
||||
"os"
|
||||
"time"
|
||||
"wireguard-dashboard/client"
|
||||
@ -31,6 +32,11 @@ func (fileSystem) UploadFile(file []byte, suffix string) (filePath string, err e
|
||||
return ossObj.LongPath, nil
|
||||
case "local":
|
||||
filePath = fmt.Sprintf("%v/%d-avatar%s", config.Config.File.Path, time.Now().Unix(), suffix)
|
||||
// 创建目录
|
||||
if err = os.MkdirAll(filePath, os.FileMode(0777)); err != nil {
|
||||
log.Errorf("本地存储目录创建失败: %v", err)
|
||||
return "", err
|
||||
}
|
||||
if err = os.WriteFile(filePath, file, os.FileMode(0777)); err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user