diff --git a/Dockerfile b/Dockerfile index 0598e9b..a485dcf 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,4 +7,9 @@ RUN npm install && npm run build # 使用 nginx 作为生产环境 FROM nginx:stable-alpine COPY --from=builder /app/dist /usr/share/nginx/html + +# 设置静态资源的访问权限,避免 403 Forbidden +RUN find /usr/share/nginx/html -type f -exec chmod 644 {} \; \ + && find /usr/share/nginx/html -type d -exec chmod 755 {} \; + COPY nginx.conf /etc/nginx/conf.d/default.conf