32 lines
620 B
Docker
32 lines
620 B
Docker
# Base image
|
|
FROM oven/bun:1 AS base
|
|
|
|
# Set working directory
|
|
WORKDIR /app
|
|
|
|
# Install dependencies with bun
|
|
FROM base AS deps
|
|
COPY package.json bun.lock* ./
|
|
RUN bun install --frozen-lockfile
|
|
|
|
# Rebuild the source code only when needed
|
|
FROM base AS builder
|
|
WORKDIR /app
|
|
COPY --from=deps /app/node_modules ./node_modules
|
|
COPY . .
|
|
RUN bun run build -d
|
|
|
|
# Production image, copy all the files and run next
|
|
FROM base AS runner
|
|
WORKDIR /app
|
|
|
|
ENV NODE_ENV=production
|
|
ENV PORT=3000
|
|
|
|
# Copy built static site + server
|
|
COPY --from=builder /app/dist ./dist
|
|
COPY server.ts ./server.ts
|
|
|
|
EXPOSE 3000
|
|
CMD ["bun", "run", "server.ts"]
|