Spaces:
Sleeping
Sleeping
| # Stage 1: Build | |
| FROM node:20-alpine AS builder | |
| WORKDIR /app | |
| COPY package*.json ./ | |
| # Install all dependencies including devDependencies for building | |
| RUN npm install | |
| COPY . . | |
| # Build the TypeScript code | |
| RUN npm run build | |
| # Stage 2: Production | |
| FROM node:20-alpine | |
| WORKDIR /app | |
| COPY package*.json ./ | |
| # Install only production dependencies | |
| RUN npm ci --only=production | |
| # Copy built assets from builder stage | |
| COPY --from=builder /app/dist ./dist | |
| # Expose the application port | |
| EXPOSE 7860 | |
| # Start the server | |
| CMD ["npm", "start"] | |