|
FROM ubuntu:22.04 |
|
|
|
USER root |
|
|
|
ENV PYTHONDONTWRITEBYTECODE=1 |
|
ENV PYTHONUNBUFFERED=1 |
|
ENV DEBIAN_FRONTEND=noninteractive |
|
ENV PIP_ROOT_USER_ACTION=ignore |
|
ENV HOME=/home/user |
|
ENV PLAYWRIGHT_BROWSERS_PATH=${HOME}/.cache/ms-playwright |
|
ENV LD_LIBRARY_PATH=/usr/lib/playwright:/usr/lib/x86_64-linux-gnu |
|
ENV GRADIO_NODE_PORT=disabled |
|
|
|
RUN useradd -m -d /home/user user && \ |
|
mkdir -p ${HOME}/.cache/ms-playwright && \ |
|
mkdir -p /usr/lib/playwright && \ |
|
chown -R user:user ${HOME}/.cache && \ |
|
chmod -R 755 ${HOME}/.cache |
|
|
|
RUN apt-get update && \ |
|
apt-get install -y --no-install-recommends \ |
|
python3.11 \ |
|
python3-pip \ |
|
python3.11-dev \ |
|
wget \ |
|
unzip \ |
|
ca-certificates \ |
|
libnss3 \ |
|
libnss3-tools \ |
|
libnspr4 \ |
|
libatk1.0-0 \ |
|
libatk-bridge2.0-0 \ |
|
libatspi2.0-0 \ |
|
libcups2 \ |
|
libxcomposite1 \ |
|
libxdamage1 \ |
|
libxrandr2 \ |
|
libxkbcommon0 \ |
|
libx11-xcb1 \ |
|
libxcursor1 \ |
|
libxi6 \ |
|
libxss1 \ |
|
libxtst6 \ |
|
libasound2 \ |
|
libx11-6 \ |
|
libxcb1 \ |
|
libxext6 \ |
|
libxfixes3 \ |
|
libxrender1 \ |
|
libdbus-1-3 \ |
|
libdrm2 \ |
|
libpango-1.0-0 \ |
|
fonts-liberation \ |
|
fonts-noto-color-emoji \ |
|
gcc && \ |
|
apt-get clean && \ |
|
rm -rf /var/lib/apt/lists/* |
|
|
|
RUN ln -s /usr/lib/x86_64-linux-gnu/libnss3.so /usr/lib/playwright/ && \ |
|
ln -s /usr/lib/x86_64-linux-gnu/libnssutil3.so /usr/lib/playwright/ && \ |
|
ln -s /usr/lib/x86_64-linux-gnu/libsmime3.so /usr/lib/playwright/ && \ |
|
ln -s /usr/lib/x86_64-linux-gnu/libnspr4.so /usr/lib/playwright/ && \ |
|
ln -s /usr/lib/x86_64-linux-gnu/libatk-1.0.so.0 /usr/lib/playwright/ && \ |
|
ln -s /usr/lib/x86_64-linux-gnu/libatk-bridge-2.0.so.0 /usr/lib/playwright/ && \ |
|
ln -s /usr/lib/x86_64-linux-gnu/libcups.so.2 /usr/lib/playwright/ && \ |
|
ln -s /usr/lib/x86_64-linux-gnu/libatspi.so.0 /usr/lib/playwright/ && \ |
|
ln -s /usr/lib/x86_64-linux-gnu/libXcomposite.so.1 /usr/lib/playwright/ && \ |
|
ln -s /usr/lib/x86_64-linux-gnu/libXdamage.so.1 /usr/lib/playwright/ |
|
|
|
WORKDIR /app |
|
|
|
COPY requirements.txt ./ |
|
RUN pip3 install --no-cache-dir -r requirements.txt |
|
|
|
RUN PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1 pip3 install playwright==1.30.0 |
|
|
|
RUN cd ${HOME}/.cache/ms-playwright && \ |
|
wget -q https://playwright.azureedge.net/builds/chromium/1045/chromium-linux.zip && \ |
|
unzip chromium-linux.zip && \ |
|
rm chromium-linux.zip && \ |
|
chmod -R 755 ${HOME}/.cache/ms-playwright |
|
|
|
COPY . . |
|
|
|
RUN chown -R user:user /app && \ |
|
chmod -R 755 /app && \ |
|
chmod -R 755 ${HOME}/.cache/ms-playwright && \ |
|
chmod -R 755 /usr/lib/playwright |
|
|
|
USER user |
|
|
|
CMD ["python3", "app.py"] |
|
|