Switch from yarn to bun

This commit is contained in:
Christoph Haas 2026-05-21 22:26:22 +02:00
parent 237077c153
commit d0402a3497
6 changed files with 460 additions and 1413 deletions

View file

@ -4,7 +4,7 @@
# --- Version Arguments ---
ARG RUBY_VERSION=3.2.4
ARG NODE_VERSION=22.16.0
ARG YARN_VERSION=1.22.22
ARG BUN_VERSION=1.3.9
# --- Stage 1: Grab Node.js Binaries ---
# We use the official image as a source for pre-compiled binaries
@ -26,9 +26,9 @@ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
COPY --from=node_source /usr/local/bin/node /usr/local/bin/node
COPY --from=node_source /usr/local/lib/node_modules /usr/local/lib/node_modules
# Re-link npm and install Yarn (Instantly available)
# Re-link npm and install Bun (Instantly available)
RUN ln -s /usr/local/lib/node_modules/npm/bin/npm-cli.js /usr/local/bin/npm && \
npm install -g yarn@${YARN_VERSION}
npm install -g bun@${BUN_VERSION}
# Set production environment
ENV RAILS_ENV="production" \
@ -55,9 +55,8 @@ RUN --mount=type=cache,target=/usr/local/bundle/cache \
bundle exec bootsnap precompile --gemfile
# 2. Install JavaScript dependencies (Separate COPY for maximum caching)
COPY package.json yarn.lock ./
RUN --mount=type=cache,target=/tmp/yarn-cache \
yarn install --immutable
COPY package.json bun.lock ./
RUN bun install --frozen-lockfile
# 3. Copy application code
COPY . .