The tinypdf-plus package is installed from GitHub and requires git during npm install. Co-Authored-By: Claude <noreply@anthropic.com>
44 lines
879 B
Docker
44 lines
879 B
Docker
FROM node:20-alpine AS builder
|
|
|
|
# Install OpenSSL and Git for Prisma and GitHub dependencies
|
|
RUN apk add --no-cache openssl git
|
|
|
|
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
|
|
|
|
# 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"]
|