Skip to content

Commit

Permalink
Use poetry to install cci and d2x
Browse files Browse the repository at this point in the history
  • Loading branch information
jlantz committed Oct 29, 2024
1 parent 0c775cc commit c601a0b
Show file tree
Hide file tree
Showing 4 changed files with 412 additions and 761 deletions.
71 changes: 28 additions & 43 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,34 @@ FROM salesforce/cli:latest-full AS base

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

# Install Python
RUN apt-get update && apt-get upgrade -y && apt-get install -y python3-pip

# 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 && \
# Install Python, Poetry, and GitHub CLI
RUN apt-get update && apt-get upgrade -y && apt-get install -y python3-pip curl gnupg && \
curl -sSL https://install.python-poetry.org | python3 - && \
echo "export PATH=$HOME/.local/bin:$PATH" >> /root/.bashrc && \
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

# Ensure Poetry is in the PATH
ENV PATH="/root/.local/bin:$PATH"

# Copy d2x and CumulusCI pyproject.toml files
COPY pyproject.d2x.toml /usr/local/d2x/pyproject.toml
COPY pyproject.cci.toml /usr/local/cci/pyproject.toml

# Set up d2x environment
RUN cd /usr/local/d2x && \
poetry install

# Set up CumulusCI environment
RUN cd /usr/local/cci && \
poetry install

# Copy d2x source code
COPY d2x /usr/local/d2x

# Install CumulusCI
RUN pip --no-cache-dir install git+https://github.com/muselab-d2x/CumulusCI@1ae7db2af cookiecutter keyrings.alt /usr/local/d2x
# Install CumulusCI and other Python packages
RUN pip --no-cache-dir install git+https://github.com/muselab-d2x/CumulusCI@1ae7db2af cookiecutter keyrings.alt

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

# Setup PATH
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

# 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
# Set up PATH for both environments
ENV PATH="/usr/local/d2x/.venv/bin:/usr/local/cci/.venv/bin:$PATH"

# Final stage for no browser automation support
FROM base AS no-browser
# Verify installations
RUN python -c "import d2x" && \
cci version

USER d2x
CMD ["bash"]
Loading

0 comments on commit c601a0b

Please sign in to comment.