Skip to content

Commit

Permalink
Attempt 3.12 upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
jlantz authored Nov 14, 2024
1 parent 24fac60 commit 734c3db
Showing 1 changed file with 23 additions and 38 deletions.
61 changes: 23 additions & 38 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ FROM salesforce/cli:latest-full AS base

LABEL org.opencontainers.image.source="https://github.com/muselab-d2x/d2x"


# Install dependencies and Python 3.12
RUN apt-get update && \
apt-get install -y --no-install-recommends software-properties-common && \
Expand All @@ -17,10 +16,11 @@ RUN apt-get update && \
# Install pip for Python 3.12
apt-get install -y --no-install-recommends python3-pip && \
\
# Set up python alternatives
update-alternatives --install /usr/bin/python python /usr/bin/python3.12 1 && \
update-alternatives --set python /usr/bin/python3.12 && \
# Create symbolic links for python and python3 to point to python3.12
ln -sf /usr/bin/python3.12 /usr/bin/python && \
ln -sf /usr/bin/python3.12 /usr/bin/python3 && \
\
# Create symbolic link for pip to pip3
ln -sf /usr/bin/pip3 /usr/bin/pip && \
\
# Remove old Python 3.10 packages to save space
Expand All @@ -34,15 +34,19 @@ RUN apt-get update && \
rm -rf /var/lib/apt/lists/*

# Verify Python installation
RUN python --version
RUN python --version && \
python3 --version && \
pip --version

# Install GitHub CLI
RUN curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | gpg --dearmor -o /usr/share/keyrings/githubcli-archive-keyring.gpg && \
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | tee /etc/apt/sources.list.d/github-cli.list > /dev/null && \
apt-get update && apt-get install -y gh
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | tee /etc/apt/sources.list.d/github-cli.list > /dev/null && \
apt-get update && \
apt-get install -y gh && \
rm -rf /var/lib/apt/lists/*

# Install CumulusCI
RUN pip --no-cache-dir install git+https://github.com/muselab-d2x/CumulusCI@d2x-merge-cci4 cookiecutter
# Install CumulusCI and Cookiecutter
RUN pip install --no-cache-dir git+https://github.com/muselab-d2x/CumulusCI@d2x-merge-cci4 cookiecutter

# Copy devhub auth script and make it executable
COPY devhub.sh /usr/local/bin/devhub.sh
Expand All @@ -51,43 +55,24 @@ RUN chmod +x /usr/local/bin/devhub.sh
# Create d2x user
RUN useradd -r -m -s /bin/bash -c "D2X User" d2x

# Setup PATH
# Setup PATH for root and d2x user
RUN echo 'export PATH=~/.local/bin:$PATH' >> /root/.bashrc && \
echo 'export PATH=~/.local/bin:$PATH' >> /home/d2x/.bashrc && \
echo '/usr/local/bin/devhub.sh' >> /root/.bashrc && \
echo '/usr/local/bin/devhub.sh' >> /home/d2x/.bashrc

# # Stage for ChromeDriver
# FROM base AS chromedriver

# # Install ChromeDriver
# RUN apt-get install -y wget unzip && \
# wget -O /tmp/chromedriver.zip https://chromedriver.storage.googleapis.com/$(curl -s https://chromedriver.storage.googleapis.com/LATEST_RELEASE)/chromedriver_linux64.zip && \
# unzip /tmp/chromedriver.zip -d /usr/local/bin/ && \
# rm /tmp/chromedriver.zip

# # Stage for Playwright
# FROM base AS playwright

# # Install Playwright
# RUN npm install -g playwright && \
# npx playwright install
echo 'export PATH=~/.local/bin:$PATH' >> /home/d2x/.bashrc && \
echo '/usr/local/bin/devhub.sh' >> /root/.bashrc && \
echo '/usr/local/bin/devhub.sh' >> /home/d2x/.bashrc

# Stage for full browser support (ChromeDriver + Playwright)
FROM base AS browser

# # Install ChromeDriver
# RUN apt-get install -y wget unzip && \
# wget -O /tmp/chromedriver.zip https://chromedriver.storage.googleapis.com/$(curl -s https://chromedriver.storage.googleapis.com/LATEST_RELEASE)/chromedriver_linux64.zip && \
# unzip /tmp/chromedriver.zip -d /usr/local/bin/ && \
# rm /tmp/chromedriver.zip

# Install Playwright
RUN cci robot install_playwright \
&& npx playwright install-deps
# Install Playwright and its dependencies
RUN cci robot install_playwright && \
npx playwright install-deps

# Final stage for no browser automation support
FROM base AS no-browser

# Switch to d2x user
USER d2x

# Default command
CMD ["bash"]

0 comments on commit 734c3db

Please sign in to comment.