Skip to content

Commit

Permalink
Merge pull request #3 from catalystdao/pnpm-cache
Browse files Browse the repository at this point in the history
feat: use pnpm instead of yarn
  • Loading branch information
reednaa authored Mar 7, 2024
2 parents e6b6673 + 165ccc3 commit c00e831
Show file tree
Hide file tree
Showing 5 changed files with 10,779 additions and 10,390 deletions.
8 changes: 5 additions & 3 deletions .github/workflows/docker-build.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build Docker Image
name: Build Relayer Image

on:
push:
Expand Down Expand Up @@ -35,7 +35,6 @@ jobs:
type=semver,pattern={{major}}.{{minor}}
-
name: Login to Docker Hub
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: ghcr.io
Expand All @@ -45,8 +44,11 @@ jobs:
name: Build and push
uses: docker/build-push-action@v5
with:
push: ${{ github.event_name != 'pull_request' }}
push: true
context: .
file: ./dockerfile.relayer
platforms: linux/amd64, linux/arm64
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@ The `-d` option detaches the process to the background.
Install the required dependencies with:

```bash
yarn install
pnpm install
```
- **NOTE**: The `devDependencies` are required to build the project. If running on a production machine where `NODE_ENV=production`, use `yarn install --prod=false`
- **NOTE**: The `devDependencies` are required to build the project. If running on a production machine where `NODE_ENV=production`, use `pnpm install --prod=false`

Initiate a Redis database with:
```bash
Expand All @@ -69,7 +69,7 @@ docker container run -p 6379:6379 redis

Build and start the Relayer with:
```bash
yarn start
pnpm start
```

For further insight into the requirements for running the Relayer see the `docker-compose.yaml` file.
Expand Down
27 changes: 14 additions & 13 deletions dockerfile.relayer
Original file line number Diff line number Diff line change
@@ -1,30 +1,31 @@
FROM node:18 AS BUILD_IMAGE
FROM node:18 AS base

WORKDIR /usr/catalyst-relayer

# Copy packages and install
COPY package.json yarn.lock tsconfig*.json ./
# Copy packages
COPY package.json pnpm-lock.yaml tsconfig*.json ./
RUN corepack enable

FROM base AS build
COPY abis ./abis
RUN yarn install --frozen-lockfile --prod=false
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --prod=false --frozen-lockfile

# Copy src and build
# Build
COPY src ./src
COPY drizzle ./drizzle
RUN yarn build

# Remove devDependencies
RUN npm prune --omit=dev
RUN pnpm run build

RUN pnpm prune --prod --config.ignore-scripts=true

# Production image
## Production image
FROM node:18-alpine

WORKDIR /usr/catalyst-relayer

COPY --from=BUILD_IMAGE /usr/catalyst-relayer/dist ./dist
COPY --from=BUILD_IMAGE /usr/catalyst-relayer/node_modules ./node_modules
COPY --from=build /usr/catalyst-relayer/dist ./dist
COPY --from=build /usr/catalyst-relayer/node_modules ./node_modules

COPY --from=BUILD_IMAGE /usr/catalyst-relayer/drizzle ./drizzle
COPY --from=build /usr/catalyst-relayer/drizzle ./drizzle

ENV NODE_ENV=${NODE_ENV}

Expand Down
Loading

0 comments on commit c00e831

Please sign in to comment.