|
FROM python:3.9.5-buster |
|
|
|
|
|
RUN apt-get update && apt-get install -y --no-install-recommends \ |
|
git \ |
|
wget \ |
|
curl \ |
|
unzip \ |
|
fonts-liberation \ |
|
libatk-bridge2.0-0 \ |
|
libatk1.0-0 \ |
|
libatspi2.0-0 \ |
|
libcairo2 \ |
|
libcups2 \ |
|
libgtk-3-0 \ |
|
libpango-1.0-0 \ |
|
libvulkan1 \ |
|
libxcomposite1 \ |
|
libxkbcommon0 \ |
|
libxrandr2 \ |
|
xdg-utils \ |
|
libnss3 \ |
|
libnspr4 \ |
|
libgbm1 \ |
|
ffmpeg \ |
|
&& rm -rf /var/lib/apt/lists/* |
|
|
|
|
|
RUN wget -q https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb \ |
|
&& apt-get install -y ./google-chrome-stable_current_amd64.deb \ |
|
&& rm google-chrome-stable_current_amd64.deb |
|
|
|
|
|
RUN CHROME_VERSION=$(google-chrome --version | cut -d ' ' -f3 | cut -d '.' -f1) \ |
|
&& wget -q https://chromedriver.storage.googleapis.com/LATEST_RELEASE_${CHROME_VERSION} \ |
|
&& wget -q https://chromedriver.storage.googleapis.com/$(cat LATEST_RELEASE_${CHROME_VERSION})/chromedriver_linux64.zip \ |
|
&& unzip chromedriver_linux64.zip -d /usr/bin/ \ |
|
&& rm chromedriver_linux64.zip LATEST_RELEASE_${CHROME_VERSION} |
|
|
|
|
|
RUN useradd -m -u 1000 user |
|
|
|
|
|
ENV HOME=/home/user \ |
|
PATH=/home/user/.local/bin:$PATH \ |
|
CHROME_DRIVER=/usr/bin/chromedriver \ |
|
CHROME_BIN=/usr/bin/google-chrome-stable \ |
|
PYTHONUNBUFFERED=1 |
|
|
|
|
|
WORKDIR $HOME/app |
|
|
|
|
|
USER user |
|
|
|
|
|
COPY --chown=user requirements.txt . |
|
RUN pip install --no-cache-dir --upgrade pip \ |
|
&& pip install --no-cache-dir -r requirements.txt |
|
|
|
|
|
COPY --chown=user . . |
|
|
|
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"] |