this repo has no description
1# Build stage - install dependencies
2FROM oven/bun:1 AS builder
3WORKDIR /app
4
5# Copy package files first for better caching
6COPY package.json bun.lock* ./
7
8# Install all dependencies (including dev for build)
9RUN bun install --frozen-lockfile
10
11# Copy source code
12COPY src/ ./src/
13COPY tsconfig.json ./
14
15# Production stage - smaller image
16FROM oven/bun:1-slim AS production
17WORKDIR /app
18ENV DEBIAN_FRONTEND=noninteractive
19
20# Install curl for health checks
21RUN apt-get update && apt-get install -y curl && rm -rf /var/lib/apt/lists/*
22
23# Copy package files
24COPY package.json bun.lock* ./
25
26# Install production dependencies only
27RUN bun install --frozen-lockfile --production
28
29# Copy source from builder
30COPY --from=builder /app/src ./src
31COPY --from=builder /app/tsconfig.json ./
32
33# Create data directory for SQLite and set ownership for non-root user
34RUN mkdir -p /app/data && chown -R bun:bun /app
35
36# Run as non-root user for security
37USER bun
38
39# Expose port
40EXPOSE 3000
41
42# Health check
43HEALTHCHECK --interval=30s --timeout=10s --retries=3 \
44 CMD curl -f http://localhost:3000/health || exit 1
45
46# Start the app
47CMD ["bun", "run", "src/index.ts"]