39 lines
745 B
Docker
39 lines
745 B
Docker
# Backend Dockerfile for KAIA YIELD AI
|
|
FROM node:18-alpine
|
|
|
|
# Set working directory
|
|
WORKDIR /app
|
|
|
|
# Install system dependencies
|
|
RUN apk add --no-cache \
|
|
python3 \
|
|
make \
|
|
g++ \
|
|
curl
|
|
|
|
# Copy package files
|
|
COPY package*.json ./
|
|
|
|
# Install Node.js dependencies
|
|
RUN npm ci --only=production && npm cache clean --force
|
|
|
|
# Copy application code
|
|
COPY . .
|
|
|
|
# Create non-root user
|
|
RUN addgroup -g 1001 -S nodejs && \
|
|
adduser -S nodejs -u 1001
|
|
|
|
# Change ownership of the app directory
|
|
RUN chown -R nodejs:nodejs /app
|
|
USER nodejs
|
|
|
|
# Expose port
|
|
EXPOSE 3001
|
|
|
|
# Health check
|
|
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
|
|
CMD curl -f http://localhost:3001/health || exit 1
|
|
|
|
# Start command
|
|
CMD ["npm", "start"] |