From a837c81a084b86d46c7c76a8b6b1df35fa0d9087 Mon Sep 17 00:00:00 2001 From: Nour Alharithi Date: Tue, 17 Dec 2024 09:21:03 -0800 Subject: [PATCH 1/5] revert 5cf15f51331d7224991e97793f3775d1ae154323 --- esbuild.config.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/esbuild.config.js b/esbuild.config.js index b269b11..6576824 100644 --- a/esbuild.config.js +++ b/esbuild.config.js @@ -19,10 +19,10 @@ const commonConfig = { }; (async () => { - let entryPoints = await glob("./src/**/*.ts"); + let entryPoints = await glob("./src/*.ts", { filesOnly: true }); await esbuild.build({ ...commonConfig, entryPoints, outdir: 'lib', }); -})().catch(() => process.exit(1)); +})().catch(() => process.exit(1)); \ No newline at end of file From e8d5f62290b9430fee9657bf63956794007c6c57 Mon Sep 17 00:00:00 2001 From: Nour Alharithi Date: Tue, 17 Dec 2024 09:21:15 -0800 Subject: [PATCH 2/5] Revert "fix --frozen-lockfile issue in Docker build (again)" This reverts commit 5cf15f51331d7224991e97793f3775d1ae154323. --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 2b4a453..70cf3b6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -11,7 +11,7 @@ RUN npm install -g bun typescript husky WORKDIR /app/drift-common/protocol/sdk COPY drift-common/protocol/sdk/ . -RUN bun install && bun run build +RUN bun install --production && bun run build WORKDIR /app/drift-common/common-ts COPY drift-common/common-ts/ . From f831d39b76cc99257fccce3a45f5bf3bd2f09e5e Mon Sep 17 00:00:00 2001 From: Nour Alharithi Date: Tue, 17 Dec 2024 09:21:25 -0800 Subject: [PATCH 3/5] Revert "fix --forzen-lockfile issue in Docker build" This reverts commit da0ef7b39295bd74189f21d7d37cb444ca861400. --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 70cf3b6..68ab595 100644 --- a/Dockerfile +++ b/Dockerfile @@ -15,7 +15,7 @@ RUN bun install --production && bun run build WORKDIR /app/drift-common/common-ts COPY drift-common/common-ts/ . -RUN bun install && bun run build +RUN bun install --production && bun run build WORKDIR /app COPY . . From 3c701b695293719e6f1d58d6e9d0caf20d116264 Mon Sep 17 00:00:00 2001 From: Nour Alharithi Date: Tue, 17 Dec 2024 09:21:37 -0800 Subject: [PATCH 4/5] Revert "shrink docker image / esbuildify (#319)" This reverts commit 4227c6b54653e1e50e663c042971d60505b41630. --- .dockerignore | 4 ---- Dockerfile | 41 ++++++++++++----------------------------- esbuild.config.js | 28 ---------------------------- package.json | 5 ++--- 4 files changed, 14 insertions(+), 64 deletions(-) delete mode 100644 .dockerignore delete mode 100644 esbuild.config.js diff --git a/.dockerignore b/.dockerignore deleted file mode 100644 index 60736c5..0000000 --- a/.dockerignore +++ /dev/null @@ -1,4 +0,0 @@ -*/**/node_modules/ -*/**/lib -.husky/ -node_modules/ \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 68ab595..629a61e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,36 +1,19 @@ -FROM node:20.18.1 AS builder +FROM public.ecr.aws/bitnami/node:20.18.1 +RUN apt-get install git +ENV NODE_ENV=production +RUN npm install -g typescript WORKDIR /app - -# Copy package files first to leverage cache -COPY package.json yarn.lock ./ -COPY drift-common/protocol/sdk/package.json ./drift-common/protocol/sdk/ -COPY drift-common/common-ts/package.json ./drift-common/common-ts/ - -RUN npm install -g bun typescript husky - +COPY drift-common /app/drift-common +COPY . . WORKDIR /app/drift-common/protocol/sdk -COPY drift-common/protocol/sdk/ . -RUN bun install --production && bun run build - +RUN yarn +RUN yarn build WORKDIR /app/drift-common/common-ts -COPY drift-common/common-ts/ . -RUN bun install --production && bun run build - +RUN yarn +RUN yarn build WORKDIR /app -COPY . . -# no '--production' for esbuild -RUN bun install && bun esbuild.config.js - -FROM node:20.18.1-alpine -# 'bigint-buffer' native lib for performance -# @triton-one/yellowstone-grpc so .wasm lib included -RUN apk add python3 make g++ --virtual .build &&\ - npm install -C /lib bigint-buffer @triton-one/yellowstone-grpc &&\ - apk del .build -COPY --from=builder /app/lib/ ./lib/ +RUN yarn +RUN yarn build -ENV NODE_ENV=production EXPOSE 9464 - -CMD ["node", "./lib/index.js"] \ No newline at end of file diff --git a/esbuild.config.js b/esbuild.config.js deleted file mode 100644 index 6576824..0000000 --- a/esbuild.config.js +++ /dev/null @@ -1,28 +0,0 @@ -const esbuild = require('esbuild'); -const glob = require('tiny-glob'); - -const commonConfig = { - bundle: true, - platform: 'node', - target: 'node20', - sourcemap: false, - // minify: true, makes messy debug/error output - treeShaking: true, - legalComments: 'none', - mainFields: ['module', 'main'], - metafile: true, - format: 'cjs', - external: [ - 'bigint-buffer', - '@triton-one/yellowstone-grpc' - ] -}; - -(async () => { - let entryPoints = await glob("./src/*.ts", { filesOnly: true }); - await esbuild.build({ - ...commonConfig, - entryPoints, - outdir: 'lib', - }); -})().catch(() => process.exit(1)); \ No newline at end of file diff --git a/package.json b/package.json index 2976c56..6765ccd 100644 --- a/package.json +++ b/package.json @@ -6,8 +6,8 @@ "license": "Apache-2.0", "dependencies": { "@coral-xyz/anchor": "^0.29.0", - "@drift-labs/sdk": "file:./drift-common/protocol/sdk", "@drift/common": "file:./drift-common/common-ts", + "@drift-labs/sdk": "file:./drift-common/protocol/sdk", "@opentelemetry/api": "^1.1.0", "@opentelemetry/auto-instrumentations-node": "^0.31.1", "@opentelemetry/exporter-prometheus": "^0.31.0", @@ -33,6 +33,7 @@ "response-time": "^2.3.2", "rxjs": "^7.8.1", "socket.io-redis": "^6.1.1", + "typescript": "4.5.4", "undici": "^6.16.1", "winston": "^3.8.1", "ws": "^8.14.2" @@ -41,14 +42,12 @@ "@types/k6": "^0.45.0", "@typescript-eslint/eslint-plugin": "^4.28.0", "@typescript-eslint/parser": "^4.28.0", - "esbuild": "^0.24.0", "eslint": "^7.29.0", "eslint-config-prettier": "^8.3.0", "eslint-plugin-prettier": "^3.4.0", "husky": "^7.0.4", "k6": "^0.0.0", "prettier": "^2.4.1", - "tiny-glob": "^0.2.9", "ts-node": "^10.9.1" }, "scripts": { From d3942d9fb5a3a9596bcbbc182d0252dc2eb11c86 Mon Sep 17 00:00:00 2001 From: GitHub Actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 17 Dec 2024 17:32:48 +0000 Subject: [PATCH 5/5] Bumping drift-common to 1ca315153c1e0b0c283024739d54d5f6728e098e --- drift-common | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drift-common b/drift-common index 24c4310..1ca3151 160000 --- a/drift-common +++ b/drift-common @@ -1 +1 @@ -Subproject commit 24c4310ab1e306ae3974a355fa5f3561b03db07a +Subproject commit 1ca315153c1e0b0c283024739d54d5f6728e098e