This commit is contained in:
2025-03-16 21:36:17 +08:00
parent 47fe4f337d
commit bb6db64165

View File

@@ -1,15 +1,17 @@
# Production stage FROM node:18-alpine
FROM node:18-alpine as production
WORKDIR /app WORKDIR /app
# Install serve globally COPY package.json .
RUN npm install
RUN npm install -g serve RUN npm install -g serve
# Copy built files from build stage COPY . .
RUN npm run build
COPY --from=build /app/dist ./dist COPY --from=build /app/dist ./dist
EXPOSE 3000 EXPOSE 3000
# Use the -s flag to handle SPA routing # Serve the static files after building
CMD ["serve", "-s", "dist", "-l", "3000"] CMD ["serve", "-s", "dist", "-l", "3000"]