Files
erika/Dockerfile
T

30 lines
796 B
Docker

# Stage 1: Install dependencies
FROM oven/bun:alpine AS deps
WORKDIR /app
# Copy only package files to leverage Docker layer caching
COPY package.json bun.lock ./
# Install dependencies
RUN bun install --frozen-lockfile
# Stage 2: Build the application
FROM oven/bun:alpine AS builder
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
COPY . .
# Build Next.js
RUN bun run build
# Stage 3: Production runner
FROM oven/bun:alpine AS runner
WORKDIR /app
ENV NODE_ENV=production
ENV NEXT_TELEMETRY_DISABLED=1
# Copy built assets and dependencies from builder stage
COPY --from=builder /app/public ./public
COPY --from=builder /app/.next ./.next
COPY --from=builder /app/node_modules ./node_modules
COPY --from=builder /app/package.json ./package.json
EXPOSE 3000
CMD ["bun", "start"]