Spaces:
Sleeping
Sleeping
| # Build stage | |
| FROM node:20-slim AS builder | |
| # Set working directory | |
| WORKDIR /app | |
| # Copy package files | |
| COPY package*.json ./ | |
| # Install dependencies | |
| RUN npm install | |
| # Copy source code | |
| COPY . . | |
| # Build the application | |
| RUN npm run build | |
| # Production stage | |
| FROM node:20-slim | |
| WORKDIR /app | |
| # Install serve to run the built application | |
| RUN npm install -g serve | |
| # Copy only the built files from builder stage | |
| COPY --from=builder /app/dist ./dist | |
| # Remove unnecessary files | |
| RUN rm -rf src node_modules | |
| # Expose port 7860 and serve the built application | |
| EXPOSE 7860 | |
| CMD ["serve", "-s", "dist", "-p", "7860"] |