File size: 1,291 Bytes
a2ad9bd
ea2ac1c
a2ad9bd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
ea2ac1c
c2d0f77
 
 
ea2ac1c
6abb84f
c2d0f77
a2ad9bd
c2d0f77
ea2ac1c
c2d0f77
 
ea2ac1c
6abb84f
c2d0f77
 
 
 
 
a2ad9bd
 
c2d0f77
ea2ac1c
d875eee
6abb84f
 
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
FROM python:3.9-slim

# 1. Instalar dependências do sistema como ROOT
RUN apt-get update && apt-get install -y \
    build-essential \
    python3-dev \
    libffi-dev \
    libssl-dev \
    wget \
    gnupg \
    ca-certificates \
    libglib2.0-0 \
    libnss3 \
    libnspr4 \
    libatk1.0-0 \
    libatk-bridge2.0-0 \
    libcups2 \
    libdrm2 \
    libdbus-1-3 \
    libxcb1 \
    libxkbcommon0 \
    libx11-6 \
    libxcomposite1 \
    libxdamage1 \
    libxext6 \
    libxfixes3 \
    libxrandr2 \
    libgbm1 \
    libpango-1.0-0 \
    libcairo2 \
    libasound2 \
    && rm -rf /var/lib/apt/lists/*

# 2. Configurar ambiente e caminhos
ENV PLAYWRIGHT_BROWSERS_PATH=/usr/local/share/playwright
WORKDIR /app

# 3. Instalar dependências Python GLOBALMENTE
COPY requirements.txt .
RUN pip install --no-cache-dir --upgrade pip && \
    pip install --no-cache-dir -r requirements.txt

# 4. Instalar navegadores globalmente
RUN playwright install chromium

# 5. Configurar usuário não-root para execução
RUN useradd -m -u 1000 user && \
    chown -R user:user /app && \
    chmod -R 777 /usr/local/share/playwright

# 6. Copiar código
COPY --chown=user . .

USER user
EXPOSE 7860

# Rodar diretamente com python3 para suportar o loop assíncrono interno
CMD ["python3", "app.py"]