# Build stage
FROM node:20-alpine as builder
WORKDIR /app
# Copy package files
COPY package*.json ./
# Install dependencies
RUN npm install
# Copy source code
COPY . .
# Build TypeScript code
RUN npm run build
# Production stage
FROM node:20-alpine
WORKDIR /app
# Copy package files
COPY package*.json ./
# Install production dependencies only
RUN npm ci --only=production
# Copy built files from builder
COPY --from=builder /app/build ./build
# Make the entry point executable
RUN chmod +x build/index.js
# Set the entrypoint
ENTRYPOINT ["node", "build/index.js"]