Skip to content

Commit

Permalink
refactor(reporter,relayer,executor): dockerfile and docker-compose.ym…
Browse files Browse the repository at this point in the history
…l for better monorepo support
  • Loading branch information
zengzengzenghuy committed Sep 20, 2024
1 parent a90cde0 commit 681a16f
Show file tree
Hide file tree
Showing 6 changed files with 63 additions and 76 deletions.
30 changes: 0 additions & 30 deletions Dockerfile.executor

This file was deleted.

30 changes: 0 additions & 30 deletions Dockerfile.relayer

This file was deleted.

31 changes: 16 additions & 15 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,38 +2,39 @@ version: "3.8"

services:
mongodb:
image: mongo:latest
container_name: mongodb
ports:
- "27017:27017"
networks:
- mongo-network
volumes:
- mongo-data:/data/db
image: mongo:latest
container_name: mongodb
ports:
- "27017:27017"
networks:
- mongo-network
volumes:
- mongo-data:/data/db

executor:
relayer:
build:
context: .
dockerfile: Dockerfile.executor
container_name: executor
dockerfile: packages/relayer/Dockerfile
container_name: relayer
networks:
- mongo-network
depends_on:
- mongodb

relayer:
executor:
build:
context: .
dockerfile: Dockerfile.relayer
container_name: hashi-relayer
dockerfile: packages/executor/Dockerfile
container_name: executor
networks:
- mongo-network
depends_on:
- mongodb

networks:
mongo-network:
driver: bridge

volumes:
mongo-data:
driver: local
driver: local
23 changes: 23 additions & 0 deletions packages/executor/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
FROM node:18-alpine

WORKDIR /usr/src/app

# Copy root package.json and yarn.lock for dependency resolution
COPY ../../package.json ../../yarn.lock ./

# Copy both executor and common package folders
COPY ./packages/common ./packages/common
COPY ./packages/executor ./packages/executor


# Install dependencies at root level
RUN yarn install

# Compile both common and executor packages
WORKDIR /usr/src/app/packages/common
RUN yarn compile

WORKDIR /usr/src/app/packages/executor
RUN yarn compile

CMD ["yarn", "start"]
23 changes: 23 additions & 0 deletions packages/relayer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
FROM node:18-alpine

WORKDIR /usr/src/app

# Copy root package.json and yarn.lock for dependency resolution
COPY ../../package.json ../../yarn.lock ./

# Copy both executor and common package folders
COPY ./packages/common ./packages/common
COPY ./packages/relayer ./packages/relayer


# Install dependencies at root level
RUN yarn install

# Compile both common and executor packages
WORKDIR /usr/src/app/packages/common
RUN yarn compile

WORKDIR /usr/src/app/packages/relayer
RUN yarn compile

CMD ["yarn", "start"]
2 changes: 1 addition & 1 deletion packages/reporter/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ FROM node:18-alpine

WORKDIR /usr/src/app

COPY package.json yarn.lock .env ./
COPY package.json .env ./

RUN corepack enable && \
corepack prepare --activate [email protected] && \
Expand Down

0 comments on commit 681a16f

Please sign in to comment.