GPTImageGen / Dockerfile
ByFlown's picture
Update Dockerfile
54bf76b verified
raw
history blame
1.86 kB
# Use Ubuntu as the base image for better dependency support
FROM ubuntu:20.04
# Set working directory
WORKDIR /app
# Set environment variables to avoid interactive prompts
ENV DEBIAN_FRONTEND=noninteractive
# Install system dependencies for Chrome and ChromeDriver
RUN apt-get update && apt-get install -y \
wget \
unzip \
curl \
python3 \
python3-pip \
libglib2.0-0 \
libnss3 \
libgconf-2-4 \
libfontconfig1 \
libxrender1 \
libxtst6 \
libxi6 \
libgbm-dev \
libasound2 \
libatk1.0-0 \
libatk-bridge2.0-0 \
libpango-1.0-0 \
libcairo2 \
libgtk-3-0 \
libcups2 \
libxss1 \
libappindicator3-1 \
libindicator3-7 \
&& rm -rf /var/lib/apt/lists/*
# Install Google Chrome
RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \
&& echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list \
&& apt-get update \
&& apt-get install -y google-chrome-stable \
&& rm -rf /var/lib/apt/lists/*
# Install ChromeDriver matching Chrome version
RUN CHROME_VERSION=$(google-chrome --version | grep -oP '\d+\.\d+\.\d+') \
&& CHROMEDRIVER_VERSION=$(curl -sS chromedriver.storage.googleapis.com/LATEST_RELEASE_${CHROME_VERSION}) \
&& wget -q https://chromedriver.storage.googleapis.com/${CHROMEDRIVER_VERSION}/chromedriver_linux64.zip \
&& unzip chromedriver_linux64.zip \
&& mv chromedriver /usr/local/bin/ \
&& chmod +x /usr/local/bin/chromedriver \
&& rm chromedriver_linux64.zip
# Copy requirements and install Python dependencies
COPY requirements.txt .
RUN pip3 install --no-cache-dir -r requirements.txt
# Copy the app code
COPY app.py .
# Expose the port Gradio will run on
EXPOSE 7860
# Run the Gradio app
CMD ["python3", "app.py"]