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 {