ca-grow-ops-manager/backend/Dockerfile
fullsizemalt 3673509a87 Install bun in Dockerfile for tinypdf-plus build
tinypdf-plus uses bun for its build process. Installing bun
in the builder container so the package can be built.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-01-08 12:24:02 -08:00

49 lines
1.1 KiB
Docker

FROM node:20-alpine AS builder
# Install OpenSSL, Git, and Bun for Prisma, GitHub dependencies, and tinypdf-plus
RUN apk add --no-cache openssl git curl && \
curl -fsSL https://bun.sh/install | sh && \
/root/.bun/bin/bun --version
WORKDIR /app
# Copy package files
COPY package*.json ./
# Copy prisma directory if it exists, otherwise we'll handle it
COPY prisma ./prisma/
# Install dependencies
RUN npm install
# Build tinypdf-plus package
RUN cd node_modules/tinypdf-plus && /root/.bun/bin/bun run build || (echo "tinypdf-plus build failed" && exit 1)
# Copy source
COPY . .
# Generate Prisma Client
RUN npx prisma generate
# Build TypeScript
RUN npm run build
# Production image
FROM node:20-alpine
# Install OpenSSL for Prisma
RUN apk add --no-cache openssl
WORKDIR /app
# Copy built files
COPY --from=builder /app/dist ./dist
COPY --from=builder /app/node_modules ./node_modules
COPY --from=builder /app/prisma ./prisma
COPY --from=builder /app/package*.json ./
# Run as non-root
USER node
EXPOSE 3000
CMD ["sh", "-c", "npx prisma db push --skip-generate && npx prisma db seed && node dist/src/server.js"]