Python/FastAPI backend with PostgreSQL for collecting Reddit data via public .json endpoints. React/Vite dashboard for analytics. Docker Compose setup with API and worker services connecting to shared PostgreSQL. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
25 lines
582 B
Docker
25 lines
582 B
Docker
# Stage 1: Build React frontend
|
|
FROM node:20-alpine AS frontend
|
|
WORKDIR /app/frontend
|
|
COPY frontend/package.json frontend/package-lock.json ./
|
|
RUN npm ci
|
|
COPY frontend/ ./
|
|
RUN npm run build
|
|
|
|
# Stage 2: Python runtime
|
|
FROM python:3.12-slim
|
|
WORKDIR /app
|
|
|
|
COPY requirements.txt .
|
|
RUN pip install --no-cache-dir -r requirements.txt
|
|
|
|
COPY backend/ backend/
|
|
COPY alembic/ alembic/
|
|
COPY alembic.ini .
|
|
|
|
# Copy frontend build output
|
|
COPY --from=frontend /app/frontend/dist/ static/
|
|
|
|
EXPOSE 8000
|
|
CMD ["sh", "-c", "alembic upgrade head && uvicorn backend.main:app --host 0.0.0.0 --port 8000"]
|