Skip to content

Commit

Permalink
Chore: Add DockerFile for github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
ajimeno04 committed Aug 13, 2024
1 parent 97e885c commit efc4153
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 0 deletions.
43 changes: 43 additions & 0 deletions deployments/ci/Dockerfile.tests
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Dockerfile.tests located in deployments/ci

# Use the official Node.js image as a base
FROM node:21.7.1

# Install curl and other necessary tools
RUN apt-get update && apt-get install -y curl sudo

# Set the working directory inside the Docker container
WORKDIR /usr/src/app

# Copy the ABIs directory first to ensure it's available during installation
COPY ./abis ./abis

# Copy package.json and pnpm-lock.yaml for dependency installation
COPY package.json pnpm-lock.yaml ./

# Install pnpm globally
RUN npm install -g pnpm

# Install app dependencies (including running the postinstall script)
RUN pnpm install --no-frozen-lockfile

# Copy the rest of the application code
COPY . .

# Ensure the install_foundry.sh script is executable
RUN chmod +x ./deployments/ci/install_foundry.sh

# Run the Foundry and anvil installation script
RUN ./deployments/ci/install_foundry.sh

# Add Foundry binaries to the PATH
ENV PATH="/root/.foundry/bin:$PATH"

# Verify that `anvil` is correctly installed and accessible
RUN anvil --version

# Run any additional setup scripts if needed
RUN pnpm before-test # This might be where Typechain commands are executed

# Default command to run the tests
CMD ["pnpm", "test"]
25 changes: 25 additions & 0 deletions deployments/ci/install_foundry.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/sh

# Install Foundry and anvil
echo "Installing Foundry and anvil"
curl -L https://foundry.paradigm.xyz | bash

echo "Reloading the shell configuration to update PATH"
if [ -f "$HOME/.bashrc" ]; then
. "$HOME/.bashrc"
elif [ -f "$HOME/.profile" ]; then
. "$HOME/.profile"
elif [ -f "$HOME/.zshrc" ]; then
. "$HOME/.zshrc"
fi

echo "Verifying Foundry installation"
if command -v foundryup >/dev/null 2>&1; then
echo "Foundry installed successfully!"
source /home/runner/.bashrc
foundryup --version
foundryup
else
echo "Foundry installation failed. foundryup command not found."
exit 1
fi

0 comments on commit efc4153

Please sign in to comment.