Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: use pnpm instead of yarn #3

Merged
merged 6 commits into from
Mar 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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