-
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.
Showing
5 changed files
with
300 additions
and
101 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,30 @@ | ||
FROM public.ecr.aws/bitnami/node:20.18.1 | ||
RUN apt-get install git | ||
ENV NODE_ENV=production | ||
RUN npm install -g typescript | ||
FROM public.ecr.aws/docker/library/node:20 AS builder | ||
|
||
RUN npm install -g typescript bun | ||
|
||
WORKDIR /app | ||
COPY drift-common /app/drift-common | ||
COPY . . | ||
WORKDIR /app/drift-common/protocol/sdk | ||
RUN yarn | ||
RUN bun install | ||
RUN yarn build | ||
WORKDIR /app/drift-common/common-ts | ||
RUN yarn | ||
RUN bun install | ||
RUN yarn build | ||
WORKDIR /app | ||
RUN yarn | ||
RUN yarn build | ||
RUN bun install | ||
RUN node esbuild.config.js --minify-whitespace | ||
|
||
FROM public.ecr.aws/docker/library/node:20 AS modules | ||
WORKDIR /app | ||
# 'bigint-buffer' native lib for performance | ||
# @triton-one/yellowstone-grpc so .wasm lib included | ||
RUN apt update && apt install -y build-essential python3 | ||
RUN npm install -C lib bigint-buffer @triton-one/yellowstone-grpc | ||
|
||
FROM gcr.io/distroless/nodejs20-debian12 | ||
COPY --from=builder /app/lib/ ./lib/ | ||
COPY --from=modules /app/lib/node_modules/ ./lib/node_modules/ | ||
|
||
ENV NODE_ENV=production | ||
EXPOSE 9464 |
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,27 @@ | ||
const esbuild = require('esbuild'); | ||
const glob = require('tiny-glob'); | ||
|
||
const commonConfig = { | ||
bundle: true, | ||
platform: 'node', | ||
target: 'node20', | ||
sourcemap: false, | ||
minify: false, // makes messy debug/error output | ||
treeShaking: true, | ||
legalComments: 'none', | ||
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
Oops, something went wrong.