-
Notifications
You must be signed in to change notification settings - Fork 16
Experiment: Bun #39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
ItzNotABug
wants to merge
5
commits into
main
Choose a base branch
from
bun
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
Experiment: Bun #39
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
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
Some comments aren't visible on the classic Files Changed page.
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,47 @@ | ||
| node_modules | ||
| sources | ||
| sources | ||
|
|
||
| # Git | ||
| .git | ||
| .gitignore | ||
|
|
||
| # Documentation (not needed in runtime) | ||
| *.md | ||
| README* | ||
| CONTRIBUTING* | ||
| LICENSE* | ||
|
|
||
| # Build artifacts (built in Docker) | ||
| dist | ||
|
|
||
| # Lock files for other package managers | ||
| pnpm-lock.yaml | ||
| package-lock.json | ||
| yarn.lock | ||
|
|
||
| # Tests | ||
| tests | ||
|
|
||
| # IDE/Editor | ||
| .vscode | ||
| .idea | ||
| *.swp | ||
| *.swo | ||
| *~ | ||
|
|
||
| # Logs | ||
| *.log | ||
| *.log* | ||
|
|
||
| .env | ||
| .env.* | ||
|
|
||
| .DS_Store | ||
| Thumbs.db | ||
|
|
||
| .github | ||
|
|
||
| # Docker | ||
| .dockerignore | ||
| Dockerfile* | ||
| docker-compose*.yml |
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
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,4 +1,4 @@ | ||
| FROM node:18-alpine AS base | ||
| FROM oven/bun:alpine AS base | ||
|
|
||
| RUN apk add --no-cache \ | ||
| python3 \ | ||
|
|
@@ -7,49 +7,52 @@ RUN apk add --no-cache \ | |
| build-base \ | ||
| git | ||
|
|
||
| ENV PNPM_HOME="/pnpm" | ||
| ENV PATH="$PNPM_HOME:$PATH" | ||
| RUN corepack enable | ||
| RUN corepack prepare [email protected] --activate | ||
|
|
||
| FROM base AS builder | ||
|
|
||
| WORKDIR /usr/src/app | ||
|
|
||
| COPY package.json pnpm-lock.yaml ./ | ||
| RUN pnpm install --frozen-lockfile --prod | ||
| COPY package.json bun.lock* ./ | ||
|
|
||
| RUN bun install --frozen-lockfile --production | ||
|
|
||
| COPY . . | ||
| COPY src ./src | ||
| COPY scripts ./scripts | ||
|
|
||
| ARG _BUILD_GIT_URL | ||
| ARG _BUILD_GIT_BRANCH | ||
| ARG _BUILD_WEBSITE_URL | ||
| ARG _BUILD_WEBSITE_VERSION | ||
| ARG _BUILD_GIT_BRANCH=main | ||
| ARG _BUILD_WEBSITE_VERSION=cloud | ||
| ARG _BUILD_WEBSITE_URL=https://appwrite.io | ||
| ARG _BUILD_GIT_URL=https://github.com/appwrite/website.git | ||
|
|
||
| ENV _BUILD_GIT_URL=${_BUILD_GIT_URL} | ||
| ENV _BUILD_GIT_BRANCH=${_BUILD_GIT_BRANCH} | ||
| ENV _BUILD_WEBSITE_URL=${_BUILD_WEBSITE_URL} | ||
| ENV _BUILD_WEBSITE_VERSION=${_BUILD_WEBSITE_VERSION} | ||
|
|
||
| RUN pnpm run fetch-sources | ||
| RUN bun run fetch-sources | ||
|
|
||
| FROM node:18-alpine AS prod | ||
| ARG _APP_ASSISTANT_OPENAI_API_KEY | ||
| ENV _APP_ASSISTANT_OPENAI_API_KEY=${_APP_ASSISTANT_OPENAI_API_KEY} | ||
|
|
||
| ENV NODE_ENV=production | ||
| ENV PNPM_HOME="/pnpm" | ||
| ENV PATH="$PNPM_HOME:$PATH" | ||
| RUN bun build src/main.js \ | ||
| --outdir ./dist \ | ||
| --target bun \ | ||
| --minify \ | ||
| --sourcemap=none \ | ||
| --external hnswlib-node | ||
|
|
||
| RUN corepack enable | ||
| RUN corepack prepare [email protected] --activate | ||
| FROM oven/bun:alpine AS prod | ||
|
|
||
| ENV NODE_ENV=production | ||
|
|
||
| WORKDIR /usr/src/app | ||
|
|
||
| COPY --from=builder /usr/src/app/node_modules ./node_modules | ||
| COPY --from=builder /usr/src/app/dist ./dist | ||
| COPY --from=builder /usr/src/app/sources ./sources | ||
| COPY --from=builder /usr/src/app/package.json ./ | ||
| COPY --from=builder /usr/src/app/src ./src | ||
| COPY --from=builder /usr/src/app/package.json ./package.json | ||
| COPY --from=builder /usr/src/app/node_modules ./node_modules | ||
|
|
||
| ENV _APP_ASSISTANT_OPENAI_API_KEY='' | ||
| ENV _APP_ASSISTANT_OPENAI_MODEL='gpt-4o' | ||
|
|
||
| EXPOSE 3003 | ||
| CMD [ "node", "src/main.js" ] | ||
| CMD [ "bun", "dist/main.js" ] | ||
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.
🧩 Analysis chain
🏁 Script executed:
Repository: appwrite/assistant
Length of output: 2130
🏁 Script executed:
Repository: appwrite/assistant
Length of output: 2083
Remove the OpenAI API key from build arguments—it's only needed at runtime.
The API key is passed as a build ARG and then set as an ENV, but it's never actually consumed during the build process. Embeddings are generated at runtime in
src/embeddings.js, not during Docker image build. The build-time ARG is unnecessary and could expose the key in build history.Recommendation: Remove lines 33-34 and rely only on the API key being provided at container runtime (which is how it's already reset in the prod stage on line 54).
🤖 Prompt for AI Agents