File tree 4 files changed +50
-22
lines changed 4 files changed +50
-22
lines changed Original file line number Diff line number Diff line change 1
- FROM public.ecr.aws/bitnami/node:18
2
- RUN apt-get install git
3
- ENV NODE_ENV=production
4
- RUN npm install -g typescript
1
+ FROM node:18 AS builder
5
2
6
3
WORKDIR /app
7
- COPY . .
4
+
5
+ # Copy package files first to leverage cache
6
+ COPY package.json yarn.lock ./
7
+ COPY drift-common/protocol/sdk/package.json ./drift-common/protocol/sdk/
8
+ COPY drift-common/common-ts/package.json ./drift-common/common-ts/
9
+
10
+ # Install build dependencies
11
+ RUN npm install -g bun
12
+
13
+ ENV NODE_ENV=production
14
+
8
15
WORKDIR /app/drift-common/protocol/sdk
9
- RUN yarn
10
- RUN yarn build
16
+ COPY drift-common/protocol/sdk/ .
17
+ RUN bun install && bun run build
18
+
11
19
WORKDIR /app/drift-common/common-ts
12
- RUN yarn
13
- RUN yarn build
20
+ COPY drift-common/common-ts/ .
21
+ RUN bun install && bun run build
22
+
14
23
WORKDIR /app
15
- RUN yarn
16
- RUN yarn build
24
+ COPY . .
25
+ RUN bun install && bun run build
26
+
27
+ FROM node:18-alpine
28
+ COPY --from=builder /app/dist/ ./lib/
17
29
30
+ ENV NODE_ENV=production
18
31
EXPOSE 9464
19
32
20
- CMD [ "yarn " , "start" ]
33
+ CMD ["node " , "./lib/index.js" ]
Original file line number Diff line number Diff line change
1
+ const esbuild = require ( 'esbuild' ) ;
2
+
3
+ const commonConfig = {
4
+ bundle : true ,
5
+ platform : 'node' ,
6
+ target : 'node18' ,
7
+ sourcemap : true ,
8
+ // minify: true, makes messy debug/error output
9
+ treeShaking : true ,
10
+ legalComments : 'none' ,
11
+ mainFields : [ 'module' , 'main' ] ,
12
+ metafile : true ,
13
+ format : 'cjs'
14
+ } ;
15
+
16
+ esbuild . build ( {
17
+ ...commonConfig ,
18
+ entryPoints : [ 'src/index.ts' , 'src/wsConnectionManager.ts' ] ,
19
+ outdir : 'dist' ,
20
+ } ) . catch ( ( ) => process . exit ( 1 ) ) ;
Original file line number Diff line number Diff line change 21
21
"start" : " ts-node src/index.ts" ,
22
22
"ws-manager" : " ts-node src/wsConnectionManager.ts" ,
23
23
"playground" : " ts-node src/playground.ts" ,
24
- "build" : " yarn clean && tsc " ,
24
+ "build" : " yarn clean && node esbuild.config.js " ,
25
25
"clean" : " rm -rf lib" ,
26
26
"prettify" : " prettier --check './src/**/*.ts'" ,
27
- "prettify:fix" : " prettier --write './src/**/*.ts'"
27
+ "prettify:fix" : " prettier --write './src/**/*.ts'"
28
28
},
29
29
"dependencies" : {
30
30
"@aws-sdk/client-ssm" : " ^3.535.0" ,
31
31
"@aws-sdk/credential-provider-node" : " ^3.535.0" ,
32
32
"@coral-xyz/anchor" : " ^0.29.0" ,
33
- "@drift-labs/sdk" : " file:./drift-common/protocol/sdk" ,
33
+ "@drift-labs/sdk" : " file:./drift-common/protocol/sdk" ,
34
34
"@drift/common" : " file:./drift-common/common-ts" ,
35
- "@grpc/grpc-js" : " ^1.8.0" ,
35
+ "@grpc/grpc-js" : " ^1.8.0" ,
36
36
"@triton-one/yellowstone-grpc" : " 0.6.0" ,
37
37
"buffer" : " ^6.0.3" ,
38
38
"compression" : " ^1.7.4" ,
39
39
"cors" : " ^2.8.5" ,
40
40
"dotenv" : " ^16.4.5" ,
41
+ "esbuild" : " ^0.20.1" ,
41
42
"express" : " ^4.19.1" ,
42
- "ioredis" : " ^5.3.2" ,
43
43
"prom-client" : " ^15.1.0" ,
44
- "rxjs" : " ^7.8.1" ,
45
44
"ws" : " ^8.16.0"
46
45
}
47
46
}
Original file line number Diff line number Diff line change @@ -8,15 +8,11 @@ import {
8
8
DriftEnv ,
9
9
EventType ,
10
10
ResubOpts ,
11
- SwiftOrderRecord ,
12
11
Wallet ,
13
12
} from "@drift-labs/sdk" ;
14
13
import { ClientDuplexStream } from "@grpc/grpc-js" ;
15
14
import { Connection , Keypair } from "@solana/web3.js" ;
16
- import { fromEventPattern } from "rxjs" ;
17
15
import { parseLogsWithRaw } from "@drift-labs/sdk" ;
18
- import { SSMClient , GetParameterCommand } from "@aws-sdk/client-ssm" ; // ES Modules import
19
- import Redis from "ioredis" ;
20
16
import { bs58 } from "@coral-xyz/anchor/dist/cjs/utils/bytes" ;
21
17
import { getSerializerFromEventType } from "./utils/utils" ;
22
18
import { RedisClient } from "@drift/common/clients" ;
You can’t perform that action at this time.
0 commit comments