From 6052af8357e96618aeb004311d6eca9ef43624bc Mon Sep 17 00:00:00 2001 From: hanxuanyu <2252193204@qq.com> Date: Tue, 27 Jan 2026 16:22:21 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A7=BB=E9=99=A4=E9=9D=99=E6=80=81=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E6=94=AF=E6=8C=81=EF=BC=9A=E5=88=A0=E9=99=A4=E9=9D=99?= =?UTF-8?q?=E6=80=81=E8=B5=84=E6=BA=90=E7=9B=AE=E5=BD=95=E7=9B=B8=E5=85=B3?= =?UTF-8?q?=E4=BB=A3=E7=A0=81=E5=92=8C=20Dockerfile=20=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 4 +--- internal/http/router.go | 3 --- internal/service/fetcher/fetcher.go | 5 ++--- 3 files changed, 3 insertions(+), 9 deletions(-) diff --git a/Dockerfile b/Dockerfile index 70f8a90..5bbcbc2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -32,11 +32,9 @@ FROM alpine:3.21 RUN apk add --no-cache ca-certificates tzdata WORKDIR /app # 创建必要目录 -RUN mkdir -p data static +RUN mkdir -p data # 从构建阶段复制二进制文件 COPY --from=builder /app/BingPaper . -# 复制静态资源(如果有些资源没有被 embed) -COPY --from=builder /app/static ./static # 复制默认配置 COPY config.example.yaml ./data/config.yaml diff --git a/internal/http/router.go b/internal/http/router.go index 89e3190..c187c60 100644 --- a/internal/http/router.go +++ b/internal/http/router.go @@ -34,9 +34,6 @@ func SetupRouter(webFS embed.FS) *gin.Engine { // Swagger r.GET("/swagger/*any", ginSwagger.WrapHandler(swaggerFiles.Handler)) - // 静态文件 - r.Static("/static", "./static") - api := r.Group("/api/v1") { // 公共接口 diff --git a/internal/service/fetcher/fetcher.go b/internal/service/fetcher/fetcher.go index b9596f3..f3fcce8 100644 --- a/internal/service/fetcher/fetcher.go +++ b/internal/service/fetcher/fetcher.go @@ -242,9 +242,8 @@ func (f *Fetcher) saveVariant(ctx context.Context, img *model.Image, variant, fo func (f *Fetcher) saveDailyFiles(srcImg image.Image, originalData []byte) { util.Logger.Info("Saving daily files") localRoot := config.GetConfig().Storage.Local.Root - if config.GetConfig().Storage.Type != "local" { - // 如果不是本地存储,保存在静态资源目录 - localRoot = "static" + if localRoot == "" { + localRoot = "data" } if err := os.MkdirAll(localRoot, 0755); err != nil {