File size: 1,300 Bytes
dbb2091
68b0607
dbb2091
 
 
 
 
 
 
b205331
dbb2091
 
034b243
dbb2091
 
034b243
 
 
 
 
dbb2091
 
034b243
 
dbb2091
 
 
 
 
 
 
 
 
 
 
 
 
034b243
 
dbb2091
034b243
dbb2091
034b243
dbb2091
 
68b0607
dbb2091
 
68b0607
dbb2091
b205331
 
dbb2091
b205331
 
 
dbb2091
b205331
034b243
06fd36f
dbb2091
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
60
61
FROM python:3.9

# Create a non-root user
RUN useradd -m -u 1000 user
USER user
ENV PATH="/home/user/.local/bin:$PATH"

# Set the working directory
WORKDIR /app

# Install dependencies required for Chromium
USER root
RUN apt-get update && apt-get install -y \
    wget \
    unzip \
    libnss3 \
    libatk1.0-0 \
    libatk-bridge2.0-0 \
    libcups2 \
    libgbm1 \
    libxkbcommon0 \
    libpango-1.0-0 \
    libxcomposite1 \
    libxrandr2 \
    libasound2 \
    libpangocairo-1.0-0 \
    libxdamage1 \
    libgtk-3-0 \
    libxshmfence1 \
    libxcb1 \
    libx11-xcb1 \
    libxrender1 \
    libxfixes3 \
    libxcursor1 \
    libxinerama1 \
    libgl1 \
    libgl1-mesa-glx \
    fonts-liberation \
    libappindicator3-1 \
    xdg-utils \
    lsb-release \
    && rm -rf /var/lib/apt/lists/*

# Install Chromium
RUN apt-get update && apt-get install -y chromium

# Set Chromium as the default browser
ENV CHROME_BIN=/usr/bin/chromium

# Switch back to the user context
USER user

# Install Python dependencies
COPY --chown=user ./requirements.txt requirements.txt
RUN pip install --no-cache-dir --upgrade -r requirements.txt

# Copy the application code
COPY --chown=user . /app

# Define the command to run the application 
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]