File size: 2,140 Bytes
11a1f15
fa5703b
 
11a1f15
 
aeef606
188e807
aeef606
63f0f0e
 
fd5569b
9436fd3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
188e807
 
 
9436fd3
 
 
 
aeef606
 
fa5703b
 
 
 
188e807
11a1f15
63f0f0e
 
 
 
 
 
 
 
11a1f15
 
 
 
 
 
 
 
 
 
 
63f0f0e
11a1f15
 
aeef606
11a1f15
 
aeef606
9436fd3
aeef606
 
11a1f15
fa5703b
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# Use Python 3.10 slim image based on Debian Buster as the base image
FROM python:3.10-slim-buster

# Set up system dependencies required for Chrome and general utilities
USER root
RUN apt-get update && apt-get install -y \
    software-properties-common \
    wget \
    curl \
    unzip \
    xvfb \
    libxi6 \
    libgconf-2-4 \
    fonts-liberation \
    libasound2 \
    libatk-bridge2.0-0 \
    libatk1.0-0 \
    libatspi2.0-0 \
    libcairo2 \
    libcups2 \
    libdbus-1-3 \
    libglib2.0-0 \
    libgtk-3-0 \
    libnspr4 \
    libnss3 \
    libpango-1.0-0 \
    libxcomposite1 \
    libxdamage1 \
    libxkbcommon0 \
    libvulkan1 \
    libu2f-udev \
    libgbm1 \
    xdg-utils \
    libcurl4 \
    --no-install-recommends \
 && apt-get clean \
 && rm -rf /var/lib/apt/lists/*

# Download and install Google Chrome
RUN wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb \
 && apt install ./google-chrome-stable_current_amd64.deb -y \
 && rm ./google-chrome-stable_current_amd64.deb

# Download and install Chromedriver
RUN LATEST=`curl -sSL https://chromedriver.storage.googleapis.com/LATEST_RELEASE` && \
    wget -N http://chromedriver.storage.googleapis.com/$LATEST/chromedriver_linux64.zip -P ~/ && \
    unzip ~/chromedriver_linux64.zip -d ~/ && \
    rm ~/chromedriver_linux64.zip && \
    mv -f ~/chromedriver /usr/local/bin/chromedriver && \
    chown root:root /usr/local/bin/chromedriver && \
    chmod 0755 /usr/local/bin/chromedriver

# Set up a new user named "user" with user ID 1000 and switch to it
RUN useradd -m -u 1000 user
USER user

# Set environment variables
ENV HOME=/home/user \
    PATH=/home/user/.local/bin:$PATH \
    DISPLAY=:99

# Set the working directory to the user's home directory/app
WORKDIR $HOME/app

# Copy the current directory contents into the container at $HOME/app and set the owner to the user
COPY --chown=user . $HOME/app

# Install Python dependencies with specific versions
RUN pip3 install --no-cache-dir --upgrade -r requirements.txt

# Expose port 7860 for the Gradio app
EXPOSE 7860

# Command to run the application
CMD ["python", "app.py"]