charles_c 5 months ago
parent
commit
2a2928242e
2 changed files with 5 additions and 6 deletions
  1. 2 4
      Dockerfile.prod
  2. 3 2
      docker-compose.prod.yml

+ 2 - 4
Dockerfile.prod

@@ -57,13 +57,11 @@ COPY --from=builder /app/package.json ./package.json
 RUN mkdir -p /app/public/uploads && \
     chown -R nextjs:nodejs /app && \
     chmod -R 755 /app/public && \
-    chmod 755 /app/public/uploads && \
-    ls -la /app/public/uploads  # 用于调试
+    chmod 755 /app/public/uploads 
 
 # 再次确认 uploads 目录的权限
 RUN chown nextjs:nodejs /app/public/uploads && \
-    chmod 755 /app/public/uploads && \
-    ls -la /app/public/uploads  # 再次用于调试
+    chmod 755 /app/public/uploads 
 
 
 # 设置为非 root 用户

+ 3 - 2
docker-compose.prod.yml

@@ -15,7 +15,8 @@ services:
       - mongodb
     restart: unless-stopped  # 添加自动重启策略
     volumes:
-      - nextjs-uploads:/app/public/uploads
+      # - nextjs-uploads:/app/public/uploads
+      - ./public/uploads:/app/public/uploads:rw
     
   mongodb:
     image: mongo
@@ -37,7 +38,7 @@ services:
 
 volumes:
   mongodb_data:
-  nextjs-uploads:
+  # nextjs-uploads:
 
 networks:
   default: