FROM python:3.11-slim-bullseye AS release ENV WORKSPACE_ROOT=/app/ ENV PYTHONDONTWRITEBYTECODE=1 ENV PYTHONUNBUFFERED=1 ENV POETRY_VERSION=1.8.3 ENV DEBIAN_FRONTEND=noninteractive ENV POETRY_NO_INTERACTION=1 # Install Google Chrome RUN apt-get update -y && \ apt-get install -y gnupg wget curl --no-install-recommends && \ wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | gpg --dearmor -o /usr/share/keyrings/google-linux-signing-key.gpg && \ echo "deb [signed-by=/usr/share/keyrings/google-linux-signing-key.gpg] https://dl.google.com/linux/chrome/deb/ stable main" > /etc/apt/sources.list.d/google-chrome.list && \ apt-get update -y && \ apt-get install -y google-chrome-stable && \ rm -rf /var/lib/apt/lists/* # Install other system dependencies. RUN apt-get update -y \ && apt-get install -y --no-install-recommends build-essential \ gcc \ python3-dev \ build-essential \ libglib2.0-dev \ libnss3-dev \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* # Install Poetry using pip and clear cache RUN pip install --no-cache-dir "poetry==$POETRY_VERSION" RUN poetry config installer.max-workers 20 WORKDIR $WORKSPACE_ROOT # Copy the poetry lock file and pyproject.toml file to install dependencies COPY pyproject.toml poetry.lock $WORKSPACE_ROOT # Install the dependencies and clear cache RUN poetry config virtualenvs.create false && \ poetry install --no-root --no-interaction --no-cache --without dev && \ poetry self add 'poethepoet[poetry_plugin]' && \ rm -rf ~/.cache/pypoetry/cache/ && \ rm -rf ~/.cache/pypoetry/artifacts/ # Copy the rest of the code. COPY . $WORKSPACE_ROOT