This commit is contained in:
17
Dockerfile
17
Dockerfile
@@ -1,5 +1,4 @@
|
|||||||
# Build Stage
|
FROM node:18-alpine
|
||||||
FROM node:18-alpine as builder
|
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
@@ -11,15 +10,11 @@ RUN npm ci
|
|||||||
COPY . .
|
COPY . .
|
||||||
RUN npm run build
|
RUN npm run build
|
||||||
|
|
||||||
# Production Stage
|
# Use a simple Node static server instead of nginx
|
||||||
FROM nginx:alpine
|
RUN npm install -g serve
|
||||||
|
|
||||||
# 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
|
|
||||||
|
|
||||||
EXPOSE 80
|
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"]
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user