From a231049fa7b78793295e9d886c2c5a3b975beb87 Mon Sep 17 00:00:00 2001 From: Tatu Aalto Date: Wed, 9 Oct 2024 22:56:46 +0300 Subject: [PATCH] Fix docker to use Python 3.12 Kudos to mkorpela for fix --- docker/Dockerfile.latest_release | 61 ++++++++++++++++++++++++-------- package-lock.json | 4 +-- 2 files changed, 48 insertions(+), 17 deletions(-) diff --git a/docker/Dockerfile.latest_release b/docker/Dockerfile.latest_release index 0f7fc55d0..5720b69e6 100644 --- a/docker/Dockerfile.latest_release +++ b/docker/Dockerfile.latest_release @@ -1,26 +1,57 @@ -FROM mcr.microsoft.com/playwright:v1.47.0-focal +FROM mcr.microsoft.com/playwright:v1.48.0-focal -# Add pip +# Install Python 3.12 and set it up USER root RUN apt-get update USER root -RUN apt-get install -y python3 python3-pip +RUN apt-get install -y software-properties-common USER root -RUN pip3 install --no-cache-dir --upgrade pip wheel +RUN add-apt-repository ppa:deadsnakes/ppa USER root -RUN rm -rf /var/lib/apt/lists/* +RUN apt-get update +USER root +RUN apt-get install -y python3.12 +USER root +RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.12 1 && \ + update-alternatives --set python3 /usr/bin/python3.12 + + # Install pip for Python 3.12 +USER root +RUN curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py && \ + python3 get-pip.py && \ + rm get-pip.py + +# Upgrade pip and install wheel +USER root +RUN pip3 install --no-cache-dir --upgrade pip wheel && \ + pip3 --version && \ + python3 --version + +# Clean up +USER root +RUN apt-get clean && \ + rm -rf /var/lib/apt/lists/* +# Set environment variables ENV PATH="/home/pwuser/.local/bin:${PATH}" ENV NODE_PATH=/usr/lib/node_modules -# What were these used for previously -# RUN mv /root/.cache/ /home/pwuser/.cache -# RUN chmod a+rwx -R /home/pwuser/.cache +# Cache operations +USER root +RUN mv /root/.cache/ /home/pwuser/.cache || true +RUN chmod a+rwx -R /home/pwuser/.cache || true + +# Switch to pwuser for the remaining operations USER pwuser -RUN pip3 install --no-cache-dir --upgrade pip wheel -USER pwuser -RUN pip3 --version -USER pwuser -RUN pip3 install --no-cache-dir --user --upgrade robotframework robotframework-browser==18.9.0 -USER pwuser -RUN python3 -m Browser.entry init + +# Upgrade pip and wheel for the user +RUN pip3 install --no-cache-dir --user --upgrade pip wheel + +# Print pip version +RUN pip3 --version + +# Install RobotFramework and Browser library +RUN pip3 install --no-cache-dir --user --upgrade robotframework robotframework-browser==18.9.0 + +# Initialize Browser library +RUN python3 -m Browser.entry init \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index c74d3c933..40d25e690 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "robotframework-playwright", - "version": "18.8.1", + "version": "18.9.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "robotframework-playwright", - "version": "18.8.1", + "version": "18.9.0", "license": "Apache-2.0", "dependencies": { "@grpc/grpc-js": "^1.12.0",