File size: 1,341 Bytes
763ef0d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
FROM python:3.11-slim

ENV PYTHONUNBUFFERED=1 \
    PIP_NO_CACHE_DIR=1 \
    PIP_DISABLE_PIP_VERSION_CHECK=1 \
    DEBIAN_FRONTEND=noninteractive \
    HOME=/home/user \
    PATH=/home/user/.local/bin:$PATH \
    TASKS_DB_PATH=/data/tasks.db \
    PYTHONPATH=/home/user/app

RUN apt-get update && apt-get install -y --no-install-recommends \
        build-essential git git-lfs curl ca-certificates \
        libnss3 libatk1.0-0 libatk-bridge2.0-0 libcups2 libdrm2 libxkbcommon0 \
        libxcomposite1 libxdamage1 libxrandr2 libgbm1 libpango-1.0-0 libcairo2 \
        libasound2 libatspi2.0-0 \
    && rm -rf /var/lib/apt/lists/* \
    && git lfs install --system

RUN useradd -m -u 1000 user
WORKDIR /home/user/app

COPY --chown=user:user backend/requirements.txt /home/user/app/backend/requirements.txt
RUN pip install --no-cache-dir -r /home/user/app/backend/requirements.txt

# Playwright Chromium (best-effort; skip if it fails so build still completes)
RUN python -m playwright install --with-deps chromium || \
    python -m playwright install chromium || \
    echo "playwright install failed; continuing"

RUN mkdir -p /data && chown -R user:user /data

COPY --chown=user:user . /home/user/app
RUN chown -R user:user /home/user/app

USER user
EXPOSE 7860

CMD ["uvicorn", "backend.app:app", "--host", "0.0.0.0", "--port", "7860"]