# ============================================================================= # MCP WALLET SERVER DOCKERFILE # ============================================================================= # Build stage FROM node:20-alpine AS builder WORKDIR /app # Copy package files COPY package*.json ./ # Install dependencies RUN npm ci --only=production=false # Copy source COPY tsconfig.json ./ COPY src ./src # Build RUN npm run build # Prune dev dependencies RUN npm prune --production # ============================================================================= # Production stage # ============================================================================= FROM node:20-alpine AS production WORKDIR /app # Create non-root user RUN addgroup -g 1001 -S nodejs && \ adduser -S wallet -u 1001 # Copy built artifacts COPY --from=builder --chown=wallet:nodejs /app/node_modules ./node_modules COPY --from=builder --chown=wallet:nodejs /app/dist ./dist COPY --from=builder --chown=wallet:nodejs /app/package.json ./ # Create logs directory RUN mkdir -p logs && chown wallet:nodejs logs # Switch to non-root user USER wallet # Expose port EXPOSE 3090 # Health check HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \ CMD wget --no-verbose --tries=1 --spider http://localhost:3090/health || exit 1 # Start server CMD ["node", "dist/index.js"]