mirror of
https://github.com/nethunterzist/trendyol-analiz
synced 2026-07-01 17:37:04 +00:00
Ne yaptık: - Sahibinden.com tarzı Miller Columns kategori seçici (CategorySelector.jsx) - Trendyol API'den 3971 kategori ağacı çekildi (Playwright ile) - Backend: JSON tree tabanlı kategori endpoint'leri (/api/category-tree/*) - Backend: Rapor oluşturma artık DB kategorilerine bağımlı değil - Report tablosundaki category_id FK constraint kaldırıldı - Dockerfile'a trendyol_category_tree.json eklendi Neden yaptık: - DB'deki kategori tablosu boştu, Trendyol API ID'leri ile Excel ID'leri farklıydı - Playwright ile Trendyol'un kendi kategori ağacını çektik (3971 kategori, gerçek API ID'leri) - Miller Columns ile kullanıcı adım adım derinleşerek kategori seçebiliyor - Arama özelliği ile kelime bazlı kategori bulma da mümkün Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
62 lines
1.8 KiB
Docker
62 lines
1.8 KiB
Docker
FROM python:3.11-slim
|
|
|
|
# Metadata
|
|
LABEL maintainer="Trendyol Product Dashboard"
|
|
LABEL description="FastAPI backend for Trendyol product analytics"
|
|
|
|
WORKDIR /app
|
|
|
|
# Install system dependencies
|
|
# - libpq-dev: PostgreSQL client library for psycopg2
|
|
# - curl: Health check and debugging
|
|
RUN apt-get update && apt-get install -y \
|
|
libpq-dev \
|
|
curl \
|
|
gosu \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# Copy requirements first (Docker layer caching)
|
|
# Build context is repo root, so path is backend/
|
|
COPY backend/requirements.txt .
|
|
|
|
# Install Python dependencies
|
|
RUN pip install --no-cache-dir --upgrade pip && \
|
|
pip install --no-cache-dir -r requirements.txt
|
|
|
|
# Copy application code from backend/
|
|
COPY backend/ .
|
|
|
|
# Copy categories data (bundled into image for Coolify deployment)
|
|
COPY categories/ /data/initial-categories/
|
|
|
|
# Copy category tree JSON (Trendyol API category mapping)
|
|
COPY trendyol_category_tree.json /data/trendyol_category_tree.json
|
|
|
|
# Create data directories with proper permissions
|
|
RUN mkdir -p /data/categories /data/reports /data/logs && \
|
|
chmod -R 755 /data
|
|
|
|
# Make startup script executable (before switching to non-root user)
|
|
RUN chmod +x startup.sh
|
|
|
|
# Create non-root user for security
|
|
RUN useradd -m -u 1001 appuser && \
|
|
chown -R appuser:appuser /app /data
|
|
|
|
# Expose backend port
|
|
EXPOSE 8001
|
|
|
|
# Health check configuration
|
|
HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=5 \
|
|
CMD curl -f http://localhost:8001/health || exit 1
|
|
|
|
# Environment variables (can be overridden at runtime)
|
|
ENV PYTHONUNBUFFERED=1 \
|
|
DATABASE_URL=postgresql://postgres:trendyol123@postgres:5432/trendyol_db \
|
|
CATEGORIES_DIR=/data/categories \
|
|
REPORTS_DIR=/data/reports \
|
|
CATEGORY_TREE_PATH=/data/trendyol_category_tree.json
|
|
|
|
# Start with migration script
|
|
CMD ["./startup.sh"]
|