-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #321 from drift-labs/master
master -> mainnet
- Loading branch information
Showing
5 changed files
with
65 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
*/**/node_modules/ | ||
*/**/lib | ||
.husky/ | ||
node_modules/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,36 @@ | ||
FROM public.ecr.aws/bitnami/node:20.18.1 | ||
RUN apt-get install git | ||
ENV NODE_ENV=production | ||
RUN npm install -g typescript | ||
FROM node:20.18.1 AS builder | ||
|
||
WORKDIR /app | ||
COPY drift-common /app/drift-common | ||
COPY . . | ||
|
||
# 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 | ||
|
||
WORKDIR /app/drift-common/protocol/sdk | ||
RUN yarn | ||
RUN yarn build | ||
COPY drift-common/protocol/sdk/ . | ||
RUN bun install && bun run build | ||
|
||
WORKDIR /app/drift-common/common-ts | ||
RUN yarn | ||
RUN yarn build | ||
COPY drift-common/common-ts/ . | ||
RUN bun install && bun run build | ||
|
||
WORKDIR /app | ||
RUN yarn | ||
RUN yarn build | ||
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/ | ||
|
||
ENV NODE_ENV=production | ||
EXPOSE 9464 | ||
|
||
CMD ["node", "./lib/index.js"] |
Submodule drift-common
updated
40 files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
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"); | ||
await esbuild.build({ | ||
...commonConfig, | ||
entryPoints, | ||
outdir: 'lib', | ||
}); | ||
})().catch(() => process.exit(1)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters