Skip to content

Commit

Permalink
Merge pull request #1 from lidofinance/feat/ci-workflow
Browse files Browse the repository at this point in the history
feat: add CD pipeline to automate image build process
  • Loading branch information
Ivan-Feofanov authored Sep 24, 2024
2 parents 299f6b7 + 431ed93 commit 0fe4510
Show file tree
Hide file tree
Showing 6 changed files with 257 additions and 284 deletions.
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
cache
node_modules
34 changes: 34 additions & 0 deletions .github/workflows/build_and_push_image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: build and push image

on:
push:
tags:
- '*'

jobs:
docker:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to ghcr.io
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push
uses: docker/[email protected]
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: ghcr.io/lidofinance/hardhat-node:${{ github.ref_name }}
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
# Want to help us make this template better? Share your feedback here: https://forms.gle/ybq9Krt8jtBL3iCk7

ARG NODE_VERSION=lts
ARG PNPM_VERSION=9.1.0
ARG PNPM_VERSION=9.11.0

FROM node:${NODE_VERSION}-alpine

# Use production node environment by default.
ENV NODE_ENV production
ENV NODE_ENV=production

# Install pnpm.
RUN --mount=type=cache,target=/root/.npm \
Expand All @@ -36,4 +36,4 @@ COPY . .
EXPOSE 8545

# Run the application.
CMD pnpm start
CMD ["pnpm", "start"]
21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Docker image to run local hardhat node

### Run

To run the mainnet fork you have to set one of the following environment variables:
- `INFURA_TOKEN` to use Infura as provider
- `ALCHEMY_TOKEN` to use Alchemy as provider
- `ETH_RPC_URL` to use a custom provider

### Examples
```bash
docker run -e INFURA_TOKEN=your_token -p 8545:8545 -it --rm lidofinance/hardhat-node:latest
```

```bash
docker run -e ALCHEMY_TOKEN=your_token -p 8545:8545 -it --rm lidofinance/hardhat-node:latest
```

```bash
docker run -e ETH_RPC_URL=your_url -p 8545:8545 -it --rm lidofinance/hardhat-node:latest
```
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@
"@nomicfoundation/hardhat-ethers": "^3.0.4",
"dotenv": "^16.3.1",
"ethers": "^6.7.1",
"hardhat": "^2.16.1"
"hardhat": "2.22.11"
}
}
Loading

0 comments on commit 0fe4510

Please sign in to comment.