Skip to content

Commit

Permalink
Merge pull request #65 from torusresearch/develop
Browse files Browse the repository at this point in the history
Release: backend optimization
  • Loading branch information
tanguyenvn authored Aug 19, 2024
2 parents 1ba3a42 + 7772d63 commit d46e4e4
Show file tree
Hide file tree
Showing 12 changed files with 596 additions and 1,074 deletions.
3 changes: 2 additions & 1 deletion .env.development
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ IPFS_HOSTNAME=ipfs
IPFS_PROTOCOL=http
IPFS_PORT=5001
METADATA_ENV=development
SENTRY_SAMPLE_RATE=0.1
SENTRY_SAMPLE_RATE=1
SENTRY_TRACES_SAMPLE_RATE=0.01
SENTRY_DSN=
LOG_LEVEL=debug
2 changes: 0 additions & 2 deletions .github/workflows/develop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,7 @@ jobs:
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG -t $ECR_REGISTRY/$ECR_REPOSITORY:$GITHUB_SHA .
echo "Pushing image to ECR..."
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
echo "::set-output name=image::$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG"
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$GITHUB_SHA
echo "::set-output name=image::$ECR_REGISTRY/$ECR_REPOSITORY:$GITHUB_SHA"
- name: Deploy
timeout-minutes: 10
run: |
Expand Down
4 changes: 0 additions & 4 deletions .github/workflows/master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,7 @@ jobs:
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG -t $ECR_REGISTRY/$ECR_REPOSITORY:$GITHUB_SHA .
echo "Pushing image to ECR..."
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
echo "::set-output name=image::$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG"
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$GITHUB_SHA
echo "::set-output name=image::$ECR_REGISTRY/$ECR_REPOSITORY:$GITHUB_SHA"
- name: Deploy
timeout-minutes: 10
run: |
Expand Down Expand Up @@ -110,9 +108,7 @@ jobs:
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG -t $ECR_REGISTRY/$ECR_REPOSITORY:$GITHUB_SHA .
echo "Pushing image to ECR..."
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
echo "::set-output name=image::$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG"
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$GITHUB_SHA
echo "::set-output name=image::$ECR_REGISTRY/$ECR_REPOSITORY:$GITHUB_SHA"
- name: Deploy
timeout-minutes: 10
run: |
Expand Down
31 changes: 23 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,20 +1,35 @@
FROM node:20-alpine

WORKDIR /app

COPY package*.json ./
# for build
FROM node:20-alpine AS build

ENV NODE_OPTIONS --max-old-space-size=4096

WORKDIR /app

RUN apk add --no-cache --virtual .gyp \
python3 \
make \
g++ \
&& npm ci && apk del .gyp
g++

COPY package*.json ./

RUN npm ci

COPY . .

RUN npm run build
RUN npm run build

# for production
FROM node:20-alpine

ENV NODE_OPTIONS --max-old-space-size=4096

WORKDIR /app

COPY package*.json ./

RUN npm ci --omit=dev --ignore-scripts

COPY --from=build /app/dist ./dist

EXPOSE 5051

Expand Down
13 changes: 7 additions & 6 deletions Dockerfile.dev
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
FROM node:20-alpine

WORKDIR /app

COPY package*.json ./

ENV NODE_OPTIONS --max-old-space-size=4096

WORKDIR /app

RUN apk add --no-cache --virtual .gyp \
python3 \
make \
g++ \
&& npm install && apk del .gyp
g++

COPY package*.json ./

RUN npm install && apk del .gyp

COPY . .

Expand Down
7 changes: 2 additions & 5 deletions docker-compose-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ services:
# ports:
# - "5001:5001/tcp"
redis:
restart: always
image: redis:6-alpine
image: redis:6
env_file:
- ./.env.development
ports:
Expand All @@ -16,9 +15,8 @@ services:
test: redis-cli --raw incr ping
timeout: 1s
mysql:
restart: always
platform: linux/x86_64
image: mysql:8
command: --max_allowed_packet=67108864 # 64 MB
env_file:
- ./.env.development
ports:
Expand All @@ -29,7 +27,6 @@ services:
test: ["CMD", "mysqladmin", "ping", "-h", "localhost"]
timeout: 1s
torus-metadata:
restart: "no"
depends_on:
mysql:
condition: service_healthy
Expand Down
22 changes: 15 additions & 7 deletions docker-compose.dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,35 @@ services:
# ports:
# - "5001:5001/tcp"
redis:
restart: always
image: redis
image: redis:6
env_file:
- ./.env.development
ports:
- "6379:6379"
healthcheck:
interval: 5s
retries: 5
test: redis-cli --raw incr ping
timeout: 1s
mysql:
restart: always
# platform: linux/x86_64
image: mysql:8
command: --max_allowed_packet=67108864 # 64 MB
env_file:
- ./.env.development
ports:
- "3306:3306"
healthcheck:
interval: 5s
retries: 5
test: ["CMD", "mysqladmin", "ping", "-h", "localhost"]
timeout: 1s
torus-metadata:
restart: always
depends_on:
- mysql
mysql:
condition: service_healthy
redis:
condition: service_healthy
# - ipfs
- redis
build:
context: .
dockerfile: Dockerfile.dev
Expand Down
10 changes: 0 additions & 10 deletions docker-compose.yml

This file was deleted.

Loading

0 comments on commit d46e4e4

Please sign in to comment.