This repository was archived by the owner on Nov 6, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 17
feat: Migrating to bun #52
Open
AnshGupta01
wants to merge
8
commits into
asetalias:main
Choose a base branch
from
AnshGupta01:issue-branch
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
abc82cf
Added Changes
AnshGupta01 d4a28d6
feat: migrating to bun
AnshGupta01 c6e6911
change to CONTRIBUTING.md
AnshGupta01 66a3b56
change to prod.Dockerfile
AnshGupta01 4f83d70
scripts modified as per review
AnshGupta01 13332d4
Server working as intended
AnshGupta01 8846574
fixing prod.dockerFile
AnshGupta01 b45065c
Fixing Dev script & closing-with-grace plugin
AnshGupta01 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
Binary file not shown.
This file contains hidden or 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 hidden or 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,21 +1,19 @@ | ||
| FROM node:18-alpine as builder | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove
|
||
| FROM oven/bun:alpine as builder | ||
|
|
||
| WORKDIR /app | ||
|
|
||
| COPY package.json yarn.lock ./ | ||
| RUN yarn install --frozen-lockfile | ||
| COPY package.json bun.lockb ./ | ||
| RUN bun install --frozen-lockfile | ||
| COPY . . | ||
| RUN yarn build:ts | ||
|
|
||
| FROM node:slim | ||
| FROM oven/bun:alpine | ||
|
|
||
| ENV NODE_ENV production | ||
| USER node | ||
|
|
||
| WORKDIR /app | ||
| COPY --from=builder /app/package.json /app/yarn.lock ./ | ||
| RUN yarn install --frozen-lockfile --production | ||
| COPY --from=builder /app/package.json /app/bun.lockb ./ | ||
| RUN bun install --frozen-lockfile --production | ||
| COPY --from=builder /app/dist ./dist | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Copy all files ( |
||
|
|
||
| CMD ["yarn", "fastify", "start", "-a", "::", "-l", "info", "dist/app.js"] | ||
|
|
||
| CMD ["bun", "start"] | ||
This file contains hidden or 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,38 @@ | ||
| // Read the .env file. | ||
| import * as dotenv from "dotenv"; | ||
| dotenv.config(); | ||
|
|
||
| // Require the framework | ||
| import Fastify from "fastify"; | ||
|
|
||
| // Require library to exit fastify process, gracefully (if possible) | ||
| //import closeWithGrace from "close-with-grace"; | ||
|
|
||
| // Instantiate Fastify with some config | ||
| const app = Fastify({ | ||
| logger: true, | ||
| }); | ||
|
|
||
| // Register your application as a normal plugin. | ||
| app.register(import("./src/app")); | ||
|
|
||
| // delay is the number of milliseconds for the graceful close to finish | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Clean up commented out code |
||
| // const closeListeners = closeWithGrace({ delay: 500 }, async function ({ signal, err, manual }) { | ||
| // if (err) { | ||
| // app.log.error(err) | ||
| // } | ||
| // await app.close() | ||
| // } as closeWithGrace.CloseWithGraceAsyncCallback) | ||
|
|
||
| // app.addHook('onClose', async (instance, done) => { | ||
| // closeListeners.uninstall() | ||
| // done() | ||
| // }) | ||
|
|
||
| // Start listening. | ||
| app.listen({ port: parseInt(process.env.PORT || "3000") }, (err: any) => { | ||
| if (err) { | ||
| app.log.error(err); | ||
| process.exit(1); | ||
| } | ||
| }); | ||
This file contains hidden or 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 hidden or 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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.