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_16.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/package*.json ./admin-frontend/ WORKDIR /app/admin-frontend # Install dependencies first (better caching) RUN npm install --silent # Copy frontend source code COPY admin-frontend/ ./ # Build with increased memory for Node.js and disable optimization ENV NODE_OPTIONS="--max-old-space-size=4096" ENV GENERATE_SOURCEMAP=false ENV DISABLE_ESLINT_PLUGIN=true ENV CI=false ENV REACT_APP_API_URL="" ENV PUBLIC_URL="/admin" ENV TSC_COMPILE_ON_ERROR=true ENV ESLINT_NO_DEV_ERRORS=true # Build React app RUN npm run build # Verify build output RUN ls -la build/ && test -f 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 8294 # Run the admin interface CMD ["python", "-m", "src.admin.app"]