diff --git a/Dockerfile b/Dockerfile index c332e56..2990785 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,4 @@ -# Build Stage -FROM node:18-alpine as builder +FROM node:18-alpine WORKDIR /app @@ -11,15 +10,11 @@ RUN npm ci COPY . . RUN npm run build -# Production Stage -FROM nginx:alpine - -# Copy built assets from builder stage -COPY --from=builder /app/dist /usr/share/nginx/html - -# Copy custom nginx config if needed (using default for now) -# COPY nginx.conf /etc/nginx/conf.d/default.conf +# Use a simple Node static server instead of nginx +RUN npm install -g serve EXPOSE 80 -CMD ["nginx", "-g", "daemon off;"] +# Serve the built SPA on port 80, with history fallback so /admin 等前端路由都可直接访问 +CMD ["serve", "-s", "dist", "-l", "80"] +