-
Notifications
You must be signed in to change notification settings - Fork 3.8k
feat(bun): upgrade to bun, reduce docker image size by 95%, upgrade docs & ci #369
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
Changes from all commits
b4a2d85
e780fd8
99e18b8
7837c1e
f74aadf
730bf83
b1ccc86
df3e9d0
db8e2f7
c51b5e1
f5bdd01
d2ea965
1ad8140
37fbb12
2af6957
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,29 +1,35 @@ | ||
| FROM node:20-bullseye | ||
| # Use the latest Bun canary image for development | ||
| FROM oven/bun:canary | ||
|
|
||
| # Avoid warnings by switching to noninteractive | ||
| ENV DEBIAN_FRONTEND=noninteractive | ||
|
|
||
| # Install necessary packages for development | ||
| RUN apt-get update \ | ||
| && apt-get -y install --no-install-recommends \ | ||
| git curl wget jq sudo postgresql-client \ | ||
| git curl wget jq sudo postgresql-client vim nano \ | ||
| bash-completion ca-certificates lsb-release gnupg \ | ||
| && apt-get clean -y \ | ||
| && rm -rf /var/lib/apt/lists/* | ||
|
|
||
| # Create a non-root user | ||
| ARG USERNAME=node | ||
| ARG USERNAME=bun | ||
| ARG USER_UID=1000 | ||
| ARG USER_GID=$USER_UID | ||
|
|
||
| # Add sudo support | ||
| RUN echo "$USERNAME ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/$USERNAME \ | ||
| && chmod 0440 /etc/sudoers.d/$USERNAME | ||
|
|
||
| # Make sure we have the latest npm | ||
| RUN npm install -g npm@latest | ||
| # Install global packages for development | ||
| RUN bun install -g turbo drizzle-kit typescript @types/node | ||
|
|
||
| # Install global packages | ||
| RUN npm install -g drizzle-kit turbo | ||
| # Install bun completions | ||
| RUN bun completions > /etc/bash_completion.d/bun | ||
|
|
||
| # Set up shell environment | ||
| RUN echo "export PATH=$PATH:/home/$USERNAME/.bun/bin" >> /etc/profile | ||
|
Contributor
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. logic: PATH modification uses undefined $PATH which could be empty at this point in the build |
||
| RUN echo "source /etc/profile" >> /etc/bash.bashrc | ||
|
|
||
| # Switch back to dialog for any ad-hoc use of apt-get | ||
| ENV DEBIAN_FRONTEND=dialog | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,12 +1,11 @@ | ||
| # Exclude files from Docker build | ||
| .git | ||
| .github | ||
| node_modules | ||
| .next | ||
| .vercel | ||
| .husky | ||
| .env | ||
| .env.* | ||
| npm-debug.log | ||
| LICENSE | ||
| NOTICE | ||
| .prettierrc | ||
| .prettierignore | ||
| README.md | ||
| .devcontainer | ||
| .gitignore | ||
| .husky | ||
| .github | ||
| .devcontainer | ||
| .env.example | ||
| node_modules | ||
|
Contributor
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. style: Add exclusions for common build artifacts and logs: .next/, build/, dist/, *.log to optimize build context size |
||
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,7 +1,7 @@ | ||||||||||
| version: 2 | ||||||||||
| updates: | ||||||||||
| - package-ecosystem: 'npm' | ||||||||||
| directory: 'apps/sim' | ||||||||||
| - package-ecosystem: 'bun' | ||||||||||
| directory: '/apps/sim' | ||||||||||
|
Comment on lines
+3
to
+4
Contributor
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. 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.
Suggested change
|
||||||||||
| schedule: | ||||||||||
| interval: 'weekly' | ||||||||||
| day: 'monday' | ||||||||||
|
|
@@ -21,9 +21,9 @@ updates: | |||||||||
| patterns: | ||||||||||
| - '*' | ||||||||||
|
|
||||||||||
| # Documentation site dependencies (/docs) | ||||||||||
| - package-ecosystem: 'npm' | ||||||||||
| directory: 'apps/docs' | ||||||||||
| # Documentation site dependencies (/apps/docs) | ||||||||||
| - package-ecosystem: 'bun' | ||||||||||
| directory: '/apps/docs' | ||||||||||
| schedule: | ||||||||||
| interval: 'weekly' | ||||||||||
| day: 'wednesday' | ||||||||||
|
|
@@ -42,7 +42,7 @@ updates: | |||||||||
| - '*' | ||||||||||
|
|
||||||||||
| # Root-level dependencies (if any) | ||||||||||
| - package-ecosystem: 'npm' | ||||||||||
| - package-ecosystem: 'bun' | ||||||||||
| directory: '/' | ||||||||||
| schedule: | ||||||||||
| interval: 'weekly' | ||||||||||
|
|
||||||||||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,64 @@ | ||||||
| name: Build and Publish Docker Image | ||||||
|
|
||||||
| on: | ||||||
| push: | ||||||
| branches: [main] | ||||||
| tags: ['v*'] | ||||||
|
Comment on lines
+4
to
+6
Contributor
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. style: Consider adding workflow_dispatch event to allow manual triggering of the workflow when needed |
||||||
|
|
||||||
| jobs: | ||||||
| build-and-push: | ||||||
| runs-on: ubuntu-latest | ||||||
| strategy: | ||||||
| fail-fast: false | ||||||
| matrix: | ||||||
| include: | ||||||
| - dockerfile: ./docker/app.Dockerfile | ||||||
| image: ghcr.io/simstudioai/simstudio | ||||||
| - dockerfile: ./docker/db.Dockerfile | ||||||
| image: ghcr.io/simstudioai/migrations | ||||||
| permissions: | ||||||
| contents: read | ||||||
| packages: write | ||||||
|
|
||||||
| steps: | ||||||
| - name: Checkout repository | ||||||
| uses: actions/checkout@v4 | ||||||
|
|
||||||
| - name: Set up QEMU | ||||||
| uses: docker/setup-qemu-action@v3 | ||||||
|
|
||||||
| - name: Set up Docker Buildx | ||||||
| uses: docker/setup-buildx-action@v3 | ||||||
|
|
||||||
| - name: Log in to the Container registry | ||||||
| if: github.event_name != 'pull_request' | ||||||
| uses: docker/login-action@v3 | ||||||
| with: | ||||||
| registry: simstudioai | ||||||
|
Contributor
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. logic: The registry value 'simstudioai' appears incorrect. For GitHub Container Registry, it should be 'ghcr.io'
Suggested change
|
||||||
| username: ${{ github.repository_owner }} | ||||||
| password: ${{ secrets.GITHUB_TOKEN }} | ||||||
|
|
||||||
| - name: Extract metadata (tags, labels) for Docker | ||||||
| id: meta | ||||||
| uses: docker/metadata-action@v5 | ||||||
| with: | ||||||
| images: ${{ matrix.image }} | ||||||
| tags: | | ||||||
| type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' }} | ||||||
| type=ref,event=pr | ||||||
| type=semver,pattern={{version}} | ||||||
| type=semver,pattern={{major}}.{{minor}} | ||||||
| type=semver,pattern={{major}}.{{minor}}.{{patch}} | ||||||
| type=sha,format=long | ||||||
|
|
||||||
| - name: Build and push Docker image | ||||||
| uses: docker/build-push-action@v5 | ||||||
| with: | ||||||
| context: . | ||||||
| file: ${{ matrix.dockerfile }} | ||||||
| platforms: linux/amd64,linux/arm64 | ||||||
| push: ${{ github.event_name != 'pull_request' }} | ||||||
| tags: ${{ steps.meta.outputs.tags }} | ||||||
| labels: ${{ steps.meta.outputs.labels }} | ||||||
| cache-from: type=gha | ||||||
| cache-to: type=gha,mode=max | ||||||
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.
logic: No explicit group creation or user addition commands. Could cause permission issues.