Skip to content

Commit 0486970

Browse files
authored
Merge pull request #56 from Jordan-182/dev
fix: add prisma engine support for linux alpine
2 parents 6d8f31b + 7017a69 commit 0486970

1 file changed

Lines changed: 12 additions & 4 deletions

File tree

Dockerfile

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
# Dockerfile (multi-stage) - optimized for Next.js w/ Prisma
22
# Build stage
3-
FROM node:22-alpine AS builder
3+
FROM node:22-slim AS builder
44
WORKDIR /app
55

6+
# Install system dependencies for Prisma
7+
RUN apt-get update && apt-get install -y openssl ca-certificates && rm -rf /var/lib/apt/lists/*
8+
69
# Install pnpm and build deps
710
RUN corepack enable pnpm
811
COPY package.json pnpm-lock.yaml ./
@@ -11,24 +14,29 @@ RUN pnpm install --frozen-lockfile
1114
# Copy sources
1215
COPY . .
1316

14-
# Generate prisma client & build
17+
# Generate prisma client with correct engine for Alpine
1518
RUN pnpm exec prisma generate
1619
RUN pnpm run build
1720

1821
# Production image
19-
FROM node:22-alpine AS runner
22+
FROM node:22-slim AS runner
2023
WORKDIR /app
2124
ENV NODE_ENV=production
2225

26+
# Install runtime dependencies for Prisma
27+
RUN apt-get update && apt-get install -y openssl ca-certificates && rm -rf /var/lib/apt/lists/*
28+
2329
# Create a non-root user
24-
RUN addgroup -S appgroup && adduser -S appuser -G appgroup
30+
RUN groupadd --system --gid 1001 appgroup \
31+
&& useradd --system --uid 1001 --gid appgroup --shell /bin/bash --create-home appuser
2532

2633
# Copy built artifacts + node_modules (only prod)
2734
COPY --from=builder /app/.next ./.next
2835
COPY --from=builder /app/public ./public
2936
COPY --from=builder /app/node_modules ./node_modules
3037
COPY --from=builder /app/package.json ./package.json
3138
COPY --from=builder /app/prisma ./prisma
39+
COPY --from=builder /app/src/generated ./src/generated
3240

3341
# Copy entrypoint script
3442
COPY ./docker/entrypoint.sh /entrypoint.sh

0 commit comments

Comments
 (0)