Skip to content

Commit

Permalink
Merge pull request #2 from VaporFi/dockerization
Browse files Browse the repository at this point in the history
feat: dockerize
  • Loading branch information
mejiasd3v authored Mar 15, 2024
2 parents 4ecf038 + 853cde6 commit cfe9652
Show file tree
Hide file tree
Showing 8 changed files with 100 additions and 11 deletions.
4 changes: 4 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
node_modules
.env
.env.example
.ponder
2 changes: 2 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
DATABASE_URL=
MAX_BLOCK_RANGE=
21 changes: 21 additions & 0 deletions .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Setup

description: Ponder monorepo action setup

runs:
using: composite
steps:
- name: Set up pnpm
uses: pnpm/action-setup@v3
with:
version: 8

- name: Set up node
uses: actions/setup-node@v4
with:
cache: pnpm
node-version: ${{ matrix.node-version }}

- name: Install dependencies
shell: bash
run: pnpm install --frozen-lockfile
31 changes: 31 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Continuous Integration

on: [push]

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
lint:
name: Lint
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
node-version: [18]
steps:
- name: Clone repository
uses: actions/checkout@v4

- name: Setup
uses: ./.github/actions/setup

- name: Codegen
run: pnpm codegen

- name: Typecheck
run: pnpm typecheck

- name: Lint
run: pnpm lint
21 changes: 21 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
ARG NODE_VERSION=18

# Alpine image
FROM node:${NODE_VERSION}-slim AS base
RUN npm install pnpm turbo --global
RUN pnpm config set store-dir ~/.pnpm-store

FROM base as installer
WORKDIR /app

COPY package.json pnpm-lock.yaml ./
RUN pnpm install --frozen-lockfile

FROM base as runner
WORKDIR /app

COPY --from=installer /app/node_modules ./node_modules
COPY . .

CMD ["pnpm", "ponder", "start"]

16 changes: 9 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
{
"name": "stratosphere-points",
"name": "stratosphere-points-indexer",
"version": "0.0.1",
"private": false,
"type": "module",
"scripts": {
"dev": "ponder dev",
"start": "ponder start",
"codegen": "ponder codegen",
"lint": "eslint .",
"typecheck": "tsc"
"lint": "eslint . --ext .ts --max-warnings 0",
"typecheck": "tsc --noEmit",
"docker:build": "docker build -t stratosphere-points-indexer .",
"docker:run": "docker run --env-file .env -p 3000:3000 stratosphere-points-indexer"
},
"dependencies": {
"@ponder/core": "^0.2.6",
"axios": "^1.6.7",
"ethers": "^6.11.1",
"viem": "^1.19.3"
"@ponder/core": "0.2.6",
"axios": "1.6.7",
"ethers": "6.11.1",
"viem": "1.19.3"
},
"devDependencies": {
"@types/node": "^20.9.0",
Expand Down
8 changes: 4 additions & 4 deletions pnpm-lock.yaml

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

8 changes: 8 additions & 0 deletions ponder.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ import { addresses } from "./src/config/constants";
import { LiquidMiningAbi } from "./abis/LiquidMiningAbi";
import { VapeStakingAbi } from "./abis/VapeStakingAbi";

const maxBlockRange = process.env.MAX_BLOCK_RANGE
? parseInt(process.env.MAX_BLOCK_RANGE)
: 2_000;

export default createConfig({
networks: {
avalanche: {
Expand All @@ -26,6 +30,7 @@ export default createConfig({
avalanche: {
address: addresses.DexAggregator?.avalanche,
startBlock: 42346292,
maxBlockRange,
},
},
},
Expand All @@ -35,6 +40,7 @@ export default createConfig({
avalanche: {
address: addresses.Stratosphere?.avalanche,
startBlock: 20310567,
maxBlockRange,
},
},
},
Expand All @@ -45,6 +51,7 @@ export default createConfig({
avalanche: {
address: addresses.LiquidMining?.avalanche,
startBlock: 32271032,
maxBlockRange,
},
},
},
Expand All @@ -55,6 +62,7 @@ export default createConfig({
avalanche: {
address: addresses.VapeStaking?.avalanche,
startBlock: 32271032,
maxBlockRange,
},
},
},
Expand Down

0 comments on commit cfe9652

Please sign in to comment.