58 lines
1.2 KiB
Docker
58 lines
1.2 KiB
Docker
# MCP Binance Connector Dockerfile
|
|
# Trading Platform
|
|
# Version: 1.0.0
|
|
|
|
# ==========================================
|
|
# Build Stage
|
|
# ==========================================
|
|
FROM node:20-alpine AS builder
|
|
|
|
WORKDIR /app
|
|
|
|
# Install dependencies
|
|
COPY package*.json ./
|
|
RUN npm ci
|
|
|
|
# Copy source and build
|
|
COPY tsconfig.json ./
|
|
COPY src ./src
|
|
RUN npm run build
|
|
|
|
# ==========================================
|
|
# Production Stage
|
|
# ==========================================
|
|
FROM node:20-alpine
|
|
|
|
WORKDIR /app
|
|
|
|
# Install production dependencies only
|
|
COPY package*.json ./
|
|
RUN npm ci --only=production && npm cache clean --force
|
|
|
|
# Copy built application
|
|
COPY --from=builder /app/dist ./dist
|
|
|
|
# Create non-root user for security
|
|
RUN addgroup -g 1001 -S nodejs && \
|
|
adduser -S mcpuser -u 1001 -G nodejs
|
|
|
|
# Create logs directory
|
|
RUN mkdir -p logs && chown -R mcpuser:nodejs logs
|
|
|
|
# Switch to non-root user
|
|
USER mcpuser
|
|
|
|
# Environment configuration
|
|
ENV NODE_ENV=production
|
|
ENV PORT=3606
|
|
|
|
# Expose port
|
|
EXPOSE 3606
|
|
|
|
# Health check
|
|
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
|
|
CMD wget --no-verbose --tries=1 --spider http://localhost:3606/health || exit 1
|
|
|
|
# Start application
|
|
CMD ["node", "dist/index.js"]
|