-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
merge master (docker build improvements) (#30)
* Shrink docker image (#27) * Shrink docker image * Add build deps for bigint-buffer * Revert "Shrink docker image (#27)" This reverts commit ae1eecc. * Chore/shrink docker image (#28) * shrink docker image (esbuild + multistage docker build) * use bun for build (#29) * add missing docker image tags
- Loading branch information
1 parent
1f886a6
commit 7b869fb
Showing
4 changed files
with
50 additions
and
22 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 |
---|---|---|
@@ -1,20 +1,33 @@ | ||
FROM public.ecr.aws/bitnami/node:18 | ||
RUN apt-get install git | ||
ENV NODE_ENV=production | ||
RUN npm install -g typescript | ||
FROM node:18 AS builder | ||
|
||
WORKDIR /app | ||
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/ | ||
|
||
# Install build dependencies | ||
RUN npm install -g bun | ||
|
||
ENV NODE_ENV=production | ||
|
||
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 . . | ||
RUN bun install && bun run build | ||
|
||
FROM node:18-alpine | ||
COPY --from=builder /app/dist/ ./lib/ | ||
|
||
ENV NODE_ENV=production | ||
EXPOSE 9464 | ||
|
||
CMD [ "yarn", "start" ] | ||
CMD ["node", "./lib/index.js"] |
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,20 @@ | ||
const esbuild = require('esbuild'); | ||
|
||
const commonConfig = { | ||
bundle: true, | ||
platform: 'node', | ||
target: 'node18', | ||
sourcemap: true, | ||
// minify: true, makes messy debug/error output | ||
treeShaking: true, | ||
legalComments: 'none', | ||
mainFields: ['module', 'main'], | ||
metafile: true, | ||
format: 'cjs' | ||
}; | ||
|
||
esbuild.build({ | ||
...commonConfig, | ||
entryPoints: ['src/index.ts', 'src/wsConnectionManager.ts'], | ||
outdir: 'dist', | ||
}).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
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