Skip to content

Commit

Permalink
Fix docker to use Python 3.12
Browse files Browse the repository at this point in the history
Kudos to mkorpela for fix
  • Loading branch information
aaltat committed Oct 9, 2024
1 parent 9443922 commit 83e357e
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 17 deletions.
61 changes: 46 additions & 15 deletions docker/Dockerfile.latest_release
Original file line number Diff line number Diff line change
@@ -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
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 83e357e

Please sign in to comment.