|
# Use Node.js 18 Alpine for smaller image size
|
|
FROM node:18-alpine
|
|
|
|
# Set working directory
|
|
WORKDIR /app
|
|
|
|
# Copy package files
|
|
COPY package*.json ./
|
|
|
|
# Install dependencies
|
|
RUN npm ci --only=production
|
|
|
|
# Copy source code
|
|
COPY . .
|
|
|
|
# Build the application
|
|
RUN npm run build
|
|
|
|
# Expose port
|
|
EXPOSE 8083
|
|
|
|
# Install curl for health checks
|
|
RUN apk add --no-cache curl
|
|
|
|
# Health check
|
|
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
|
|
CMD curl -f http://localhost:8083/rest/ai/test-ai || exit 1
|
|
|
|
# Start the application
|
|
CMD ["npm", "run", "start:prod"] |