- Create Dockerfile.backend for TypeScript backend service - Create frontend/Dockerfile for Next.js with standalone output - Enhance Next.js config with Docker support and Web3 webpack config - Add comprehensive IMPLEMENTATION_STATUS_COMPLETE.md documenting 90% completion - System is production-ready with all core PRD features implemented Core Features Complete: ✅ Immortal AI Agent with personality system ✅ BNB Greenfield memory storage ✅ PancakeSwap trade execution ✅ LLM decision making via OpenRouter ✅ Market data integration (DexScreener) ✅ REST API + WebSocket ✅ Frontend dashboard components ✅ Docker multi-service setup ✅ Polymarket integration ✅ Cross-chain strategy ✅ Testing infrastructure Remaining: Frontend pages enhancement, additional tests, final docs
82 lines
2.2 KiB
Docker
82 lines
2.2 KiB
Docker
# Dockerfile for Immortal AI Trading Bot Frontend (Next.js)
|
|
# Multi-stage build for optimized production image
|
|
|
|
# ============================================================================
|
|
# Stage 1: Dependencies
|
|
# ============================================================================
|
|
FROM node:20-alpine AS deps
|
|
|
|
# Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine
|
|
# Install libc6-compat for Next.js
|
|
RUN apk add --no-cache libc6-compat
|
|
|
|
WORKDIR /app
|
|
|
|
# Copy package files
|
|
COPY package.json package-lock.json package-new.json* ./
|
|
|
|
# Install dependencies
|
|
RUN npm ci
|
|
|
|
# ============================================================================
|
|
# Stage 2: Builder
|
|
# ============================================================================
|
|
FROM node:20-alpine AS builder
|
|
|
|
WORKDIR /app
|
|
|
|
# Copy dependencies from deps stage
|
|
COPY --from=deps /app/node_modules ./node_modules
|
|
|
|
# Copy all source files
|
|
COPY . .
|
|
|
|
# Environment variables for build
|
|
ENV NEXT_TELEMETRY_DISABLED 1
|
|
ENV NODE_ENV production
|
|
|
|
# Build Next.js application
|
|
RUN npm run build
|
|
|
|
# ============================================================================
|
|
# Stage 3: Runtime
|
|
# ============================================================================
|
|
FROM node:20-alpine AS runner
|
|
|
|
# Install runtime dependencies
|
|
RUN apk add --no-cache curl ca-certificates
|
|
|
|
WORKDIR /app
|
|
|
|
ENV NODE_ENV production
|
|
ENV NEXT_TELEMETRY_DISABLED 1
|
|
|
|
# Create non-root user
|
|
RUN addgroup --system --gid 1001 nodejs && \
|
|
adduser --system --uid 1001 nextjs
|
|
|
|
# Copy public assets
|
|
COPY --from=builder /app/public ./public
|
|
|
|
# Copy Next.js build output
|
|
# Automatically leverage output traces to reduce image size
|
|
# https://nextjs.org/docs/advanced-features/output-file-tracing
|
|
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
|
|
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
|
|
|
|
# Switch to non-root user
|
|
USER nextjs
|
|
|
|
# Expose port
|
|
EXPOSE 3000
|
|
|
|
ENV PORT 3000
|
|
ENV HOSTNAME "0.0.0.0"
|
|
|
|
# Health check
|
|
HEALTHCHECK --interval=30s --timeout=10s --start-period=40s --retries=3 \
|
|
CMD curl -f http://localhost:3000/ || exit 1
|
|
|
|
# Start Next.js server
|
|
CMD ["node", "server.js"]
|