This commit is contained in:
Leo Wen
2025-12-06 18:25:05 -08:00
parent 0e0866999c
commit f595e62e18
3 changed files with 20 additions and 13 deletions
+18 -10
View File
@@ -1,34 +1,42 @@
# Use official Bun image # Use official Bun image with Debian for native module support
FROM oven/bun:1 AS base FROM oven/bun:1.1.38-debian AS base
WORKDIR /app WORKDIR /app
# Install system dependencies needed for native modules (argon2, etc.) # Install dependencies stage with build tools for native modules
FROM base AS install
WORKDIR /app
# Install build dependencies for native modules (argon2, etc.)
RUN apt-get update && apt-get install -y \ RUN apt-get update && apt-get install -y \
python3 \ python3 \
make \ make \
g++ \ g++ \
&& rm -rf /var/lib/apt/lists/* && rm -rf /var/lib/apt/lists/*
# Install dependencies # Copy package files
FROM base AS install
WORKDIR /app
COPY package.json bun.lockb* ./ COPY package.json bun.lockb* ./
# Install all dependencies including native ones
RUN bun install RUN bun install
# Copy source files and generate Prisma client # Generate Prisma client (needs the schema)
COPY prisma ./prisma
RUN bunx prisma generate
# Build stage - copy source files
FROM base AS build FROM base AS build
WORKDIR /app WORKDIR /app
COPY --from=install /app/node_modules ./node_modules COPY --from=install /app/node_modules ./node_modules
COPY . . COPY . .
RUN bunx prisma generate
# Final production image # Final production image
FROM oven/bun:1 AS release FROM oven/bun:1.1.38-debian AS release
WORKDIR /app WORKDIR /app
# Install runtime dependencies for native modules # Install runtime dependencies
RUN apt-get update && apt-get install -y \ RUN apt-get update && apt-get install -y \
openssl \ openssl \
ca-certificates \
&& rm -rf /var/lib/apt/lists/* && rm -rf /var/lib/apt/lists/*
# Copy necessary files from build stage # Copy necessary files from build stage
BIN
View File
Binary file not shown.
+1 -2
View File
@@ -33,8 +33,7 @@
"jsonwebtoken": "^9.0.2", "jsonwebtoken": "^9.0.2",
"jwt": "^0.2.0", "jwt": "^0.2.0",
"pg": "^8.13.1", "pg": "^8.13.1",
"prisma": "^6.3.1", "prisma": "^6.3.1"
"spamscanner": "^5.1.5"
}, },
"scripts": { "scripts": {
"start": "bun src/index.ts", "start": "bun src/index.ts",