trips) migrate sqlite and runtime to bun
Some checks failed
PR Checks / lint-test-and-docker-build (pull_request) Has been cancelled

This commit is contained in:
2026-02-20 23:05:22 -05:00
parent 982c84cc33
commit e28741a4f1
7 changed files with 33 additions and 110 deletions

View File

@@ -1,33 +1,28 @@
# ── Build stage ────────────────────────────────────────────────────────────────
FROM node:22-bookworm-slim AS builder
FROM oven/bun:1 AS builder
WORKDIR /app
# Native deps required for building better-sqlite3 via node-gyp
RUN apt-get update \
&& apt-get install -y --no-install-recommends python3 make g++ \
&& rm -rf /var/lib/apt/lists/*
# Copy dependency manifests first for better layer caching
COPY package.json ./
COPY package.json bun.lock ./
# Install all deps (including devDependencies needed for the build).
RUN npm install
RUN bun install --frozen-lockfile
# Copy source and build
COPY . .
RUN npm run build
RUN bun run build
# Prune to production-only deps, recompiling native modules for Linux
RUN npm prune --omit=dev
# Prune to production-only deps
RUN bun install --frozen-lockfile --production
# ── Runtime stage ───────────────────────────────────────────────────────────────
FROM node:22-bookworm-slim AS runtime
FROM oven/bun:1 AS runtime
WORKDIR /app
# Create a non-root user to run the app
RUN groupadd --system trips && useradd --system --gid trips trips
RUN addgroup -S trips && adduser -S trips -G trips
# Copy the built app and production node_modules from the builder
COPY --from=builder /app/build ./build
@@ -45,4 +40,4 @@ ENV PORT=3000
EXPOSE 3000
CMD ["node", "build"]
CMD ["bun", "build/index.js"]