PrismaP
Prisma3mo ago
5 replies
thehungrybird_

Why prisma requires Node.js for migration even if Bun is present in dockerfile?

💻CLIORMSolved
This dockerfile does not work if I don't include Node.js in the image.

ARG NODE_VERSION=22.14.0
RUN curl -L https://raw.githubusercontent.com/tj/n/master/bin/n -o n \
    && bash n $NODE_VERSION \
    && rm n \
    && npm install -g n

Dockerfile with Bun base image:
# Dedicated service for running Prisma database migrations
# Deploy this on Railway as a separate service

FROM oven/bun:1.3.3-slim AS base

# Setup SSL libraries for Prisma
RUN ln -s /usr/lib/x86_64-linux-gnu/libssl.so /lib/libssl.so && \
    ln -s /usr/lib/x86_64-linux-gnu/libssl.so.3 /lib/libssl.so.3 && \
    ln -s /usr/lib/x86_64-linux-gnu/libcrypto.so /lib/libcrypto.so && \
    ln -s /usr/lib/x86_64-linux-gnu/libcrypto.so.3 /lib/libcrypto.so.3

RUN apt-get -y update && apt-get -y install curl && rm -rf /var/lib/apt/lists/*

WORKDIR /app

# Copy only what's needed for migrations
COPY package.json bun.lock bunfig.toml ./
COPY packages/typescript-config packages/typescript-config/
COPY packages/database packages/database/

# Copy entrypoint script
COPY docker/migrate-entrypoint.sh /app/migrate-entrypoint.sh
RUN chmod +x /app/migrate-entrypoint.sh

# Install dependencies (ignore scripts to skip husky/postinstall)
ENV HUSKY=0
RUN bun install --ignore-scripts

# Generate Prisma clients
RUN bun db:generate && bun authdb:generate

ENTRYPOINT ["/app/migrate-entrypoint.sh"]
Was this page helpful?