feat(bun): upgrade to bun, reduce docker image size by 95%, upgrade docs & ci - #369
feat(bun): upgrade to bun, reduce docker image size by 95%, upgrade docs & ci#369waleedlatif1 wants to merge 15 commits into
Conversation
…ove legacy Dockerfile and entrypoint script
… and implement GitHub Actions for Docker image build and publish
…I routes and maintain dynamic rendering
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
There was a problem hiding this comment.
PR Summary
This PR implements a major migration from Node.js/npm to Bun runtime and package manager, along with significant Docker optimizations. The changes span across the entire codebase with key improvements to environment variable handling and deployment configurations.
- Introduced multi-stage Docker builds in
docker/app.Dockerfileanddocker/db.Dockerfile, reducing image size by 95% - Added new environment variable management system in
apps/sim/lib/env.tsusing@t3-oss/env-nextjsand Zod for validation - Split Docker Compose configurations into separate files for local, production, and Ollama environments with improved health checks
- Removed local storage mode functionality from sync system (
apps/sim/stores/sync*.ts) in favor of server-based synchronization - Migrated instrumentation to separate client/server implementations with improved OpenTelemetry and Sentry integration
136 file(s) reviewed, 46 comment(s)
Edit PR Review Bot Settings | Greptile
| ARG USERNAME=bun | ||
| ARG USER_UID=1000 | ||
| ARG USER_GID=$USER_UID |
There was a problem hiding this comment.
logic: No explicit group creation or user addition commands. Could cause permission issues.
| ARG USERNAME=bun | |
| ARG USER_UID=1000 | |
| ARG USER_GID=$USER_UID | |
| ARG USERNAME=bun | |
| ARG USER_UID=1000 | |
| ARG USER_GID=$USER_UID | |
| RUN groupadd --gid $USER_GID $USERNAME \ | |
| && useradd --uid $USER_UID --gid $USER_GID -m $USERNAME |
| RUN bun completions > /etc/bash_completion.d/bun | ||
|
|
||
| # Set up shell environment | ||
| RUN echo "export PATH=$PATH:/home/$USERNAME/.bun/bin" >> /etc/profile |
There was a problem hiding this comment.
logic: PATH modification uses undefined $PATH which could be empty at this point in the build
| LICENSE | ||
| NOTICE | ||
| .prettierrc | ||
| .prettierignore | ||
| README.md | ||
| .devcontainer No newline at end of file | ||
| .gitignore | ||
| .husky | ||
| .github | ||
| .devcontainer | ||
| .env.example | ||
| node_modules No newline at end of file |
There was a problem hiding this comment.
logic: Critical files like .next (build output), .env, and .env.* (environment variables) are no longer excluded. These should remain in .dockerignore to prevent sensitive data leaks and unnecessary files in the build context.
| LICENSE | |
| NOTICE | |
| .prettierrc | |
| .prettierignore | |
| README.md | |
| .devcontainer | |
| \ No newline at end of file | |
| .gitignore | |
| .husky | |
| .github | |
| .devcontainer | |
| .env.example | |
| node_modules | |
| LICENSE | |
| NOTICE | |
| .prettierrc | |
| .prettierignore | |
| README.md | |
| .gitignore | |
| .husky | |
| .github | |
| .devcontainer | |
| .env.example | |
| node_modules | |
| .next | |
| .env | |
| .env.* |
| .github | ||
| .devcontainer | ||
| .env.example | ||
| node_modules No newline at end of file |
There was a problem hiding this comment.
style: Add exclusions for common build artifacts and logs: .next/, build/, dist/, *.log to optimize build context size
| - package-ecosystem: 'bun' | ||
| directory: '/apps/sim' |
There was a problem hiding this comment.
logic: Bun is not currently a supported package-ecosystem value for Dependabot. This will likely cause Dependabot to fail. Consider keeping 'npm' as the package-ecosystem since Bun can still use package.json and npm-style dependencies.
| - package-ecosystem: 'bun' | |
| directory: '/apps/sim' | |
| - package-ecosystem: 'npm' | |
| directory: '/apps/sim' |
|
|
||
| # Copy only package files needed for migrations | ||
| COPY package.json bun.lock turbo.json ./ | ||
| COPY apps/sim/package.json ./apps/sim/db/ |
There was a problem hiding this comment.
logic: Incorrect destination path - should be ./apps/sim/ instead of ./apps/sim/db/ to match the workspace structure
| COPY apps/sim/package.json ./apps/sim/db/ | |
| COPY apps/sim/package.json ./apps/sim/ |
| RUN bun install --omit dev --ignore-scripts && \ | ||
| bun install --omit dev --ignore-scripts drizzle-kit drizzle-orm postgres next-runtime-env |
There was a problem hiding this comment.
style: These two bun install commands can be combined into one for better layer caching: bun install --omit dev --ignore-scripts drizzle-kit drizzle-orm postgres next-runtime-env
| COPY apps/sim/package.json ./apps/sim/package.json | ||
| COPY apps/sim/lib/env.ts ./apps/sim/lib/env.ts | ||
|
|
||
| WORKDIR /app/apps/sim No newline at end of file |
There was a problem hiding this comment.
logic: Missing ENTRYPOINT/CMD to specify what the container should run (e.g. drizzle migrations)
|
|
||
| # Install dependencies local to scripts directory | ||
| npm install --save-dev typescript @types/node @types/react ts-node tsx glob | ||
| bun install --save-dev typescript @types/node @types/react ts-node tsx glob |
There was a problem hiding this comment.
style: Consider adding a check for bun installation before running bun install
| bun install --save-dev typescript @types/node @types/react ts-node tsx glob | |
| if ! command -v bun &> /dev/null; then | |
| echo "Error: bun is not installed. Please install bun first." | |
| exit 1 | |
| fi | |
| bun install --save-dev typescript @types/node @types/react ts-node tsx glob |
| "@t3-oss/env-nextjs": "0.13.4", | ||
| "@types/bun": "^1.2.12", | ||
| "@vercel/analytics": "^1.5.0", | ||
| "bun": "^1.2.13", |
There was a problem hiding this comment.
logic: Including bun package in dependencies may cause issues since it's meant to be a runtime/CLI tool. Consider moving to devDependencies or removing if not needed for compilation.
|
merged in #371 |
Description
Upgrade to bun, reduce docker image size by 95%, upgrade docs & ci
Type of change
How Has This Been Tested?
Tested manually, ensured everything works.
Checklist:
npm test)Security Considerations:
Additional Information:
In a follow-up PR, we will implement the docker container using this new docker image and make the CLI to publish the new docker image.