Dockerfile 1.3 KB
FROM node:20-alpine AS frontend-builder

WORKDIR /app/apps/web_ui

COPY apps/web_ui/package*.json ./
RUN npm ci

COPY apps/web_ui/ ./
RUN npm run build

FROM ghcr.io/666ghj/bettafish:latest

ENV PYTHONDONTWRITEBYTECODE=1 \
    PYTHONUNBUFFERED=1 \
    PLAYWRIGHT_BROWSERS_PATH=/ms-playwright

RUN apt-get update \
    && apt-get install -y --no-install-recommends nodejs \
    && rm -rf /var/lib/apt/lists/*

WORKDIR /app

COPY requirements.txt ./requirements.txt
COPY vendor/mediacrawler/requirements.txt ./media_crawler.requirements.txt
RUN python -m pip install --no-cache-dir -r requirements.txt
RUN python -m pip install --no-cache-dir -r media_crawler.requirements.txt

COPY .env.example .env
COPY . .
COPY --from=frontend-builder /app/static/frontend /app/static/frontend

RUN mkdir -p \
    /app/var/logs \
    /app/var/reports/final \
    /app/var/reports/engines/insight \
    /app/var/reports/engines/media \
    /app/var/reports/engines/query \
    /app/var/output \
    /app/var/crawler/browser_data \
    /app/logs \
    /app/final_reports \
    /app/insight_engine_streamlit_reports \
    /app/media_engine_streamlit_reports \
    /app/query_engine_streamlit_reports \
    /app/output \
    /app/browser_data \
    /app/vendor/mediacrawler/browser_data

EXPOSE 5000 8501 8502 8503

CMD ["python", "-m", "apps.web_api"]