db connect
This commit is contained in:
15
Dockerfile
15
Dockerfile
@@ -6,7 +6,7 @@ FROM base AS deps
|
||||
RUN apk add --no-cache libc6-compat
|
||||
WORKDIR /app
|
||||
|
||||
# Install dependencies based on the preferred package manager
|
||||
# Install dependencies
|
||||
COPY package.json package-lock.json* ./
|
||||
RUN npm ci --legacy-peer-deps
|
||||
|
||||
@@ -17,8 +17,10 @@ WORKDIR /app
|
||||
COPY --from=deps /app/node_modules ./node_modules
|
||||
COPY . .
|
||||
|
||||
# Prisma generate step - CRITICAL for standalone mode
|
||||
RUN npx prisma generate
|
||||
|
||||
# Environment variables must be present at build time for Next.js
|
||||
# Coolify will provide these, but we can set defaults
|
||||
ENV NEXT_TELEMETRY_DISABLED=1
|
||||
|
||||
RUN npm run build
|
||||
@@ -40,16 +42,21 @@ RUN mkdir .next
|
||||
RUN chown nextjs:nodejs .next
|
||||
|
||||
# Automatically leverage output traces to reduce image size
|
||||
# https://nextjs.org/docs/advanced-features/output-file-tracing
|
||||
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
|
||||
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
|
||||
|
||||
# We might need the prisma schema for runtime tasks if used,
|
||||
# but for standalone, the client is already bundled.
|
||||
# However, adding it doesn't hurt for 'db push' tasks in Coolify.
|
||||
COPY --from=builder --chown=nextjs:nodejs /app/prisma ./prisma
|
||||
|
||||
USER nextjs
|
||||
|
||||
EXPOSE 3000
|
||||
|
||||
ENV PORT=3000
|
||||
# set hostname to localhost
|
||||
ENV HOSTNAME="0.0.0.0"
|
||||
|
||||
# Note: In Coolify, you can run 'npx prisma db push' as a post-deployment script
|
||||
# or change CMD to a wrapper script that runs db push then starts the server.
|
||||
CMD ["node", "server.js"]
|
||||
|
||||
Reference in New Issue
Block a user