File tree Expand file tree Collapse file tree 5 files changed +247
-39
lines changed
Expand file tree Collapse file tree 5 files changed +247
-39
lines changed Original file line number Diff line number Diff line change 1+ * /** /node_modules
2+ * /** /lib
3+ * /** /dist
4+ .git /
5+ .husky /
Original file line number Diff line number Diff line change 1- FROM public.ecr.aws/bitnami/node:20.18.1
2- RUN apt-get install git
3- ENV NODE_ENV=production
4- RUN npm install -g typescript
5- RUN npm install -g ts-node
1+ FROM node:20.18.1 AS builder
2+ RUN npm install -g husky
3+
4+ COPY package.json yarn.lock ./
65
76WORKDIR /app
87
98COPY . .
109RUN yarn install
11- RUN yarn build
12- RUN yarn install --production
10+ RUN node esbuild.config.js
11+
12+ FROM node:20.18.1-alpine
13+ # 'bigint-buffer' native lib for performance
14+ RUN apk add python3 make g++ --virtual .build &&\
15+ npm install -C /lib bigint-buffer &&\
16+ apk del .build
17+ COPY --from=builder /app/lib/ ./lib/
1318
1419EXPOSE 9464
1520
16- CMD [ "yarn " , "start:all" ]
21+ CMD ["node " , "./lib/index.js" ]
Original file line number Diff line number Diff line change 1+ const esbuild = require ( 'esbuild' ) ;
2+ const glob = require ( 'tiny-glob' ) ;
3+
4+ const commonConfig = {
5+ bundle : true ,
6+ platform : 'node' ,
7+ target : 'es2020' ,
8+ sourcemap : false ,
9+ // minify: true, makes messy debug/error output
10+ treeShaking : true ,
11+ legalComments : 'none' ,
12+ mainFields : [ 'module' , 'main' ] ,
13+ metafile : true ,
14+ format : 'cjs' ,
15+ external : [
16+ 'bigint-buffer'
17+ ]
18+ } ;
19+
20+ ( async ( ) => {
21+ let entryPoints = await glob ( "./src/*.ts" , { filesOnly : true } ) ;
22+ await esbuild . build ( {
23+ ...commonConfig ,
24+ entryPoints,
25+ outdir : 'lib' ,
26+ } ) ;
27+ } ) ( ) . catch ( ( ) => process . exit ( 1 ) ) ;
Original file line number Diff line number Diff line change 4444 "@typescript-eslint/eslint-plugin" : " 5.62.0" ,
4545 "@typescript-eslint/parser" : " 4.33.0" ,
4646 "chai" : " 4.3.10" ,
47+ "esbuild" : " 0.24.0" ,
4748 "eslint" : " 7.32.0" ,
4849 "eslint-config-prettier" : " 8.10.0" ,
4950 "eslint-plugin-prettier" : " 3.4.1" ,
5051 "husky" : " 7.0.4" ,
5152 "mocha" : " 10.2.0" ,
5253 "prettier" : " 3.0.1" ,
54+ "tiny-glob" : " 0.2.9" ,
5355 "ts-node" : " 10.9.1"
5456 },
5557 "scripts" : {
5658 "prepare" : " husky install" ,
57- "build" : " yarn clean && tsc " ,
59+ "build" : " yarn clean && node esbuild.config.js " ,
5860 "clean" : " rm -rf lib" ,
5961 "start" : " node lib/index.js" ,
6062 "dev" : " NODE_OPTIONS=--max-old-space-size=8192 ts-node src/index.ts" ,
You can’t perform that action at this time.
0 commit comments