P
Prisma7mo ago
Jay

Bun App. Cant fix Prisma Generate. Dockerfile?

This is the log error when I run ./server.js on Fly.io 2024-04-26T10:34:58.943 runner[e78464ea2742d8] sin [info] Machine started in 518ms 2024-04-26T10:34:59.024 app[e78464ea2742d8] sin [info] $ NODE_ENV=production bun ./server.js 2024-04-26T10:34:59.301 app[e78464ea2742d8] sin [info] 1031 | }; 2024-04-26T10:34:59.301 app[e78464ea2742d8] sin [info] 1032 | var version = "5.13.0"; 2024-04-26T10:34:59.301 app[e78464ea2742d8] sin [info] 1033 | var clientVersion = version; 2024-04-26T10:34:59.301 app[e78464ea2742d8] sin [info] 1034 | var PrismaClient = class { 2024-04-26T10:34:59.301 app[e78464ea2742d8] sin [info] 1035 | constructor() { 2024-04-26T10:34:59.301 app[e78464ea2742d8] sin [info] 1036 | throw new Error(@prisma/client did not initialize yet. Please run "prisma generate" and try to import it again. 2024-04-26T10:34:59.301 app[e78464ea2742d8] sin [info] In case this error is unexpected for you, please report it in https://pris.ly/prisma-prisma-bug-report); 2024-04-26T10:34:59.301 app[e78464ea2742d8] sin [info] ^ 2024-04-26T10:34:59.301 app[e78464ea2742d8] sin [info] error: @prisma/client did not initialize yet. Please run "prisma generate" and try to import it again. 2024-04-26T10:34:59.301 app[e78464ea2742d8] sin [info] In case this error is unexpected for you, please report it in https://pris.ly/prisma-prisma-bug-report 2024-04-26T10:34:59.301 app[e78464ea2742d8] sin [info] at new PrismaClient (/app/server.js:1036:13) 2024-04-26T10:34:59.301 app[e78464ea2742d8] sin [info] at /app/server.js:57670:14 2024-04-26T10:34:59.304 app[e78464ea2742d8] sin [info] error: script "start" exited with code 1
GitHub
Build software better, together
GitHub is where people build software. More than 100 million people use GitHub to discover, fork, and contribute to over 420 million projects.
From An unknown user
From An unknown user
From An unknown user
1 Reply
Jay
JayOP7mo ago
# syntax = docker/dockerfile:1

# Adjust BUN_VERSION as desired
ARG BUN_VERSION=1.1.4
FROM oven/bun:${BUN_VERSION}-slim as base

LABEL fly_launch_runtime="Bun/Prisma"

# Bun/Prisma app lives here
WORKDIR /app

# Set production environment
ENV NODE_ENV="production"


# Throw-away build stage to reduce size of final image
FROM base as build

# Install packages needed to build node modules
RUN apt-get update -qq && \
apt-get install --no-install-recommends -y build-essential openssl pkg-config python-is-python3

# Install node modules
COPY --link bun.lockb package.json ./
RUN bun install

# Generate Prisma Client
COPY --link prisma .
RUN bunx prisma generate

# Copy application code
COPY --link . .

# Generate Prisma Client
RUN bunx prisma generate

# Build application
RUN bun run build

# Remove development dependencies
RUN rm -rf node_modules && \
bun install --ci


# Final stage for app image
FROM base

# Install packages needed for deployment
RUN apt-get update -qq && \
apt-get install --no-install-recommends -y openssl && \
rm -rf /var/lib/apt/lists /var/cache/apt/archives

# Copy built application
COPY --from=build /app /app

# Start the server by default, this can be overwritten at runtime
EXPOSE 3001
CMD [ "bun", "run", "start" ]
# syntax = docker/dockerfile:1

# Adjust BUN_VERSION as desired
ARG BUN_VERSION=1.1.4
FROM oven/bun:${BUN_VERSION}-slim as base

LABEL fly_launch_runtime="Bun/Prisma"

# Bun/Prisma app lives here
WORKDIR /app

# Set production environment
ENV NODE_ENV="production"


# Throw-away build stage to reduce size of final image
FROM base as build

# Install packages needed to build node modules
RUN apt-get update -qq && \
apt-get install --no-install-recommends -y build-essential openssl pkg-config python-is-python3

# Install node modules
COPY --link bun.lockb package.json ./
RUN bun install

# Generate Prisma Client
COPY --link prisma .
RUN bunx prisma generate

# Copy application code
COPY --link . .

# Generate Prisma Client
RUN bunx prisma generate

# Build application
RUN bun run build

# Remove development dependencies
RUN rm -rf node_modules && \
bun install --ci


# Final stage for app image
FROM base

# Install packages needed for deployment
RUN apt-get update -qq && \
apt-get install --no-install-recommends -y openssl && \
rm -rf /var/lib/apt/lists /var/cache/apt/archives

# Copy built application
COPY --from=build /app /app

# Start the server by default, this can be overwritten at runtime
EXPOSE 3001
CMD [ "bun", "run", "start" ]
Want results from more Discord servers?
Add your server