FROM python:3.11-slim WORKDIR /app # Install system dependencies RUN apt-get update && apt-get install -y \ gcc \ curl \ && rm -rf /var/lib/apt/lists/* # Install Node.js for frontend build RUN curl -fsSL https://deb.nodesource.com/setup_18.x | bash - \ && apt-get install -y nodejs # Copy requirements first for better caching COPY requirements-admin.txt . RUN pip install --no-cache-dir -r requirements-admin.txt # Install additional dependencies needed for production RUN pip install --no-cache-dir asyncpg python-dotenv # Copy application code COPY src/ ./src/ COPY config/ ./config/ COPY migrations/ ./migrations/ COPY alembic.ini ./ # Build frontend COPY admin-frontend/ ./admin-frontend/ WORKDIR /app/admin-frontend # Clear any existing node_modules and lock files RUN rm -rf node_modules package-lock.json yarn.lock # Install dependencies with npm (using .npmrc config) RUN npm install # Build with increased memory for Node.js ENV NODE_OPTIONS="--max-old-space-size=4096" # Build React app or create fallback RUN npm run build || mkdir -p build RUN test -f build/index.html || echo "
Interface loading...
" > build/index.html # Back to main directory WORKDIR /app # Create logs directory RUN mkdir -p logs # Set Python path ENV PYTHONPATH=/app/src # Expose admin port EXPOSE 8000 # Run the admin interface CMD ["python", "-m", "src.admin.app"]