11# syntax=docker.io/docker/dockerfile:1
2-
32FROM node:18-alpine AS base
43
54# Install dependencies only when needed
@@ -9,19 +8,23 @@ RUN apk add --no-cache libc6-compat
98WORKDIR /app
109
1110# Install dependencies based on the preferred package manager
12- COPY package.json yarn.lock* package-lock.json* pnpm-lock.yaml* .npmrc* source.config.ts next.config.* ./
11+ COPY package.json yarn.lock* package-lock.json* pnpm-lock.yaml* bun.lockb* .npmrc* source.config.ts next.config.* ./
1312RUN \
14- if [ -f yarn.lock ]; then yarn --frozen-lockfile; \
13+ if [ -f bun.lockb ]; then \
14+ apk add --no-cache curl unzip && \
15+ curl -fsSL https://bun.sh/install | bash && \
16+ /root/.bun/bin/bun install --frozen-lockfile; \
17+ elif [ -f yarn.lock ]; then yarn --frozen-lockfile; \
1518 elif [ -f package-lock.json ]; then npm ci; \
1619 elif [ -f pnpm-lock.yaml ]; then corepack enable pnpm && pnpm i --frozen-lockfile; \
1720 else echo "Lockfile not found." && exit 1; \
1821 fi
1922
20-
2123# Rebuild the source code only when needed
2224FROM base AS builder
2325WORKDIR /app
2426COPY --from=deps /app/node_modules ./node_modules
27+ COPY --from=deps /root/.bun /root/.bun
2528COPY . .
2629
2730# Next.js collects completely anonymous telemetry data about general usage.
@@ -30,7 +33,8 @@ COPY . .
3033# ENV NEXT_TELEMETRY_DISABLED=1
3134
3235RUN \
33- if [ -f yarn.lock ]; then yarn run build; \
36+ if [ -f bun.lockb ]; then /root/.bun/bin/bun run build; \
37+ elif [ -f yarn.lock ]; then yarn run build; \
3438 elif [ -f package-lock.json ]; then npm run build; \
3539 elif [ -f pnpm-lock.yaml ]; then corepack enable pnpm && pnpm run build; \
3640 else echo "Lockfile not found." && exit 1; \
@@ -57,7 +61,6 @@ COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
5761USER nextjs
5862
5963EXPOSE 8080
60-
6164ENV PORT=8080
6265
6366# server.js is created by next build from the standalone output
0 commit comments