Neurolingua's picture
Update Dockerfile
2c57aff verified
raw
history blame
1.38 kB
FROM python:3.9
# Set working directory
WORKDIR /code
# Upgrade pip first
RUN pip install --upgrade pip
# Install dependencies
RUN apt-get update && apt-get install -y \
wget \
unzip \
xvfb \
libxi6 \
libgconf-2-4 \
libnss3 \
libxss1 \
libappindicator1 \
libindicator7 \
fonts-liberation \
libasound2 \
libatk-bridge2.0-0 \
libgtk-3-0 \
libx11-xcb1 \
libxcomposite1 \
libxcursor1 \
libxdamage1 \
libxi6 \
libxtst6 \
xdg-utils \
google-chrome-stable
# Download and install ChromeDriver
RUN CHROME_VERSION=$(google-chrome --version | grep -oP '\d+\.\d+\.\d+') \
&& wget -O /tmp/chromedriver.zip https://chromedriver.storage.googleapis.com/${CHROME_VERSION}/chromedriver_linux64.zip \
&& unzip /tmp/chromedriver.zip -d /usr/local/bin/ \
&& rm /tmp/chromedriver.zip
# Copy the requirements file
COPY ./requirements.txt /code/requirements.txt
# Install the Python dependencies
RUN pip install --no-cache-dir -r /code/requirements.txt
# Copy the rest of the application code
COPY . /code
# Create a custom cache directory with correct permissions
RUN mkdir -p /code/selenium_cache && chmod -R 755 /code/selenium_cache
# Set the environment variable for the custom cache directory
ENV XDG_CACHE_HOME /code/selenium_cache
# Command to run the application
CMD ["python", "app.py"]